Basic unicode help?

BlitzMax Forums/BlitzMax Programming/Basic unicode help?

Tachyon(Posted 2009) [#1]
Sorry- another afternoon of searching for answers on my own has led me nowhere, so I have to ask for help. I need some basic help getting a unicode file read into my game. First a short example of how I read data into my game...

My game pulls data in from .txt files via TStream=ReadFile("file.txt") and then ReadLine. I process each line to look for embedded script keywords, and everything else gets printed to the screen via DrawText. So, a particular line might read like:

John dropped the book. <drop_item book> The book fell to the floor.

I can have this single line translated into Russian easily enough, making sure anything inside of the < > is ignored so not to mess up the game.

My question is: so now that I have a unicode .txt file containing Russian text, what do I need to do to get it working with my game? My normal method of ReadFile and ReadLine does not work of course.


markcw(Posted 2009) [#2]
Chain a Russian to your computer (or better yet pay him) and tell him to ring you when he's got it working.


Tachyon(Posted 2009) [#3]
Thanks for the advice. In further searching I found that Grey Alien wrote some unicode functions in his framework, which I am a proud owner of. I'll see what I can uncover there.


Tachyon(Posted 2009) [#4]
Ah, LoadText is the secret to reading unicode files (if anyone else finds this topic during their search for unicode help).


Grey Alien(Posted 2009) [#5]
You beat me to it: LoadText is what you need indeed. Also SaveText if you ever write files.