2 Attachment(s)
Problem reading text from file
Hello,
I am trying to read a simple text file(CSV), the problem is that some of the text in the file are written in arabic. My PC can easily read and write the language without any problems but when VB.NET reads the file it turns it into square. I attached images of the real file and how VB.NET is reading it. Does anyone have any clue on how to solve this problem?
Re: Problem reading text from file
You need to specify an Encoding that can understand the text. I believe that UTF8 is used by default but you must need to use something else. Try the different options available and see if you can find one that works.
It is sometimes possible to read the encoding from the file itself but there is no one way that will work for all files. You can read about that online if you perform the appropriate web search.
Re: Problem reading text from file
it could also be the result of the font... when text being displayed can't be represented by the font, it will display squares instead. On the back end, in storage, everything is probably file... it's just the font of the text box.
-tg
Re: Problem reading text from file
Quote:
Originally Posted by
techgnome
...everything is probably file...
Quoted for philosophical value.
Re: Problem reading text from file
Actually tg is probably correct. I thought about it after I posted and UTF8 should be able to handle those characters.
Re: Problem reading text from file
Quote:
Originally Posted by
ThomasJohnsen
Quoted for philosophical value.
Guess that would make it the font of all wisdom then? ;)