[{"data":1,"prerenderedAt":71},["ShallowReactive",2],{"/2025/09/19-import-text-files-with-garbage-characters":3},{"id":4,"title":5,"body":6,"date":62,"description":44,"extension":63,"meta":64,"navigation":65,"path":66,"robots":67,"seo":68,"stem":69,"__hash__":70},"posts/2025/09/19 import-text-files-with-garbage-characters.md","19 Import Text Files With Garbage Characters",{"type":7,"value":8,"toc":59},"minimark",[9,18,25,28,31,45,48,56],[10,11,13],"post-title",{":date":12},"date",[14,15,17],"h1",{"id":16},"import-text-files-with-garbage-characters","Import Text Files with Garbage Characters",[19,20,21],"notes",{},[22,23,24],"p",{},"This is a repost from my old blog. First posted in 10/21/2016.",[26,27],"br",{},[22,29,30],{},"I had a case in which we use VB.NET to import a text file and it didn't work properly. My code at first was:",[32,33,34],"code-block",{},[35,36,41],"pre",{"className":37,"code":39,"language":40},[38],"language-text","Dim someString As String = Encoding.ASCII.GetString(someByteArray)\n","text",[42,43,39],"code",{"__ignoreMap":44},"",[22,46,47],{},"After researching for a while, I found out that the text file is encoded using UTF-8. Thus, switching it to the following code make it work properly:",[32,49,50],{},[35,51,54],{"className":52,"code":53,"language":40},[38],"Dim someString As String = Encoding.UTF8.GetString(someByteArray)\n",[42,55,53],{"__ignoreMap":44},[22,57,58],{},"Encoding matters!",{"title":44,"searchDepth":60,"depth":60,"links":61},2,[],"2025-09-19T00:00:00.000Z","md",{},true,"/2025/09/19-import-text-files-with-garbage-characters",null,{"title":5,"description":44},"2025/09/19 import-text-files-with-garbage-characters","YX037kf0WPtuqL9TUwBsWsom2DqVLcBsLUVSyNbfE4E",1785167453144]