Link to home
Start Free TrialLog in
Avatar of 11ods
11ods

asked on

VB and Languages

Hi,

I am creating an application which reads and writes hebrew text to a .txt file, and displays the text in a listbox.
I guess that somewhere along the process of reading/writing something goes wrong and the text turns to ...strange unreadable characters.
can someone help me out, maybe some example source on how to get this done correctly?

all i need is to write hebrew text to a file,  and read it back in.
I tried of course to set the font of the listbox and other controls on the form to a hebrew font, but that doesnt seem to help ( so i suppose its in the writing process of the file which things go wrong?)

thanks in advance!
Avatar of stretch71
stretch71

There are many reasons why this could be happening.  The problem is that while VB works in unicode internally, all it's interfaces work in ANSI code pages.

What often happens is that VB will do the ANSI to Unicode conversion automatically and that this process can cause your data to be screwed up.

Without knowing more, I am assuming that the text file is created in another application (such as wordpad) and that you are reading the file in, updating it and then writing it back out.

If the application that created the initial text file saves it as unicode then VB will make a mess of it, since it will assume that the unicode string is actually an ANSI string.  To get around this, you need to read the data into a byte array and convert it to a string using a straight assignment operator.

If you could supply more info about what you are doing, and the OS involved I can help you further.
ASKER CERTIFIED SOLUTION
Avatar of VBtom
VBtom

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 11ods

ASKER

thanks both of you,

I intalled the application on the clients computer which is a hebrew based windows-unlike mine- and the application seemed to work great. read hebrew, wrote hebrew... etc.

thanks !