|
-
Nov 5th, 2012, 06:47 AM
#1
Thread Starter
Addicted Member
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?
Im using Visual Studio 2008 Professional Edition
.Net Framework 3.5
-
Nov 5th, 2012, 07:30 AM
#2
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.
-
Nov 5th, 2012, 12:49 PM
#3
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
-
Nov 5th, 2012, 01:58 PM
#4
Re: Problem reading text from file
 Originally Posted by techgnome
...everything is probably file...
Quoted for philosophical value.
In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)
-
Nov 5th, 2012, 05:12 PM
#5
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.
-
Nov 5th, 2012, 05:16 PM
#6
Re: Problem reading text from file
 Originally Posted by ThomasJohnsen
Quoted for philosophical value.
Guess that would make it the font of all wisdom then?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|