READLINE with different language characters

Previous topic - Next topic


I'm having problems loading in the translated text for my game via a file.

I've basically got a comma separated list where each line contains a translation of each word or sentence.



In my code I want to load these in:

Code (glbasic) Select
READLINE 1,strLine$
However I'm having problems.  I've converted my text file to UTF-8 and this lets me load it in (I think the default was a unicode format and READLINE returned nothing).  However a conversion is done - this is what I see in the debugger:

The Swedish text has changed the Ä.  I'm not tried the Russian text- I'm hoping once I have the Russian font loaded it will display the correct characters.

How can I load this text in without loosing the characters?



Got to the bottom of the characters - its how the text file is encoded, so nothing wrong with the READLINE command as such.  

I've got three options for saving my text files - ANSI, UTF-8, UCS-2.  Only ANSI is keeping the characters in tact, but then I loose the Russian characters, eg:


This is how ANSI text looks after I save it.  The Ä is saved in the file correctly, but ОПЦИИ becomes ?????.

I do not know how to deal with this yet, and I'm loosing time trying to get it in to the game so I think I'll have to drop it until after I'm done.


QuoteWell, i can replace eng chars with rus chars in this font, and send you translation like


So it will still print russian text on the screen smile
How about it?
Sry for my english


If you want both swedish and russian characters you need to run Unicode, nothing else can handle it. I would split the file into one file per language so you can have different character encodings but I guess Max has the better solution so you don't have to waste so much time on it.

Kitty Hello

you must save the file as plain ASCII. Then you might not see all the texts in the correct characters, but you're changing the codepage with the font, thus it should be ok.
UFT8 does: ä -> "Ä~", making 2 characters out of non-ascii chars.
Unicode has 2 bytes for each char - also bad.


Thanks Gernot, got it working in the end.  It was the Russian Characters that were giving me the problems as they occupy the same space on the ASCII table as the accented characters but when I saved the TXT file with these chars in, it saved it as a UCS-2 (NotePad++) format which caused me headaches.  XaMMaX has kindly converted them for me in a format that is compatible without me needing to find a work around.


Plain ASCII is only 7-bit, I believe it's called ANSI with all 256 chars?