VB and Languages


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!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
Hi 11ods

You need to find a font that can display a hebrew font in it's basic 0..255 charset, because text in VB controls is ANSI. Set this as the font of the listbox.
Only that should do it.
Should be easy to find with google (I needed before polish and greek fonts for similar reasons, it's easy to find free fonts on the net).

You're very lucky it's a text file (ANSI also) and not a unicode source, cause in the case of unicode, the charcters would be converted using the default codepage and the solution would be much more complex!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
11odsAuthor Commented:
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 !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.