Russian ASCII codepage.

BlitzMax Forums/MaxGUI Module/Russian ASCII codepage.

void(Posted 2009) [#1]
I found some problems with codepage.

"STRING" contains russian characters

SetGadgetText(mygadget,"STRING") - normal works

... and

file=openfile("text.txt")
in$=readline(file)
SetGadgetText(mygadget,in$) - prints ieroglifs

ASCII codes of russian codepage when reading from file is about 130 and when set from Max IDE is about 1030. I used methods for parse strings and incrase each ASCII on 848, but it is mush slowdown occurs in database application (SQlite (it's code page different to)), for loop throw higher 10000 records and converting them.

Is anybody knows methods for seting codepage?


markcw(Posted 2009) [#2]
Sorry, I don't understand.

Are you saying: if you load/read Russian chars from text files they are not converted properly?


Brucey(Posted 2009) [#3]
He's talking about a Russian codepage - where cyrillic characters will be defined in the ASCII range somewhere above ASCII code 128, and before ASCII 255.

I'm assuming this is the codepage in question.

Other than mapping it yourself, I don't see another way of doing it. (libraries like iconv will essentially do the same thing).

Does the file need to be in codepage format? You would have less issues if the text was in UTF-8.


void(Posted 2009) [#4]
Thank you Brucey, i will try it today.

But codepage incorrect here too:

folder$=requestdir("Russian text")

it shows ieroglifs in form, (sorry about offtop, i'ts not maxgui)

when i use "folder$" in next code:

dir=readdir(folder)

i must convert it too (decrase each ASCII code on 848).

and next:

file$=nextfile(dir)

it's convreting too, for use next.....

Normal code (doesn't works on russian windows):
folder$=requestdir("Russian text")
dir=readdir(folder)
file$="some..."
while file<>""
file=nextfile(dir)
wend

Updated code:

function ru$(str$)
'...parse each ascii
end function

folder$=ru(requestdir(ru("Russian text")))
dir=readdir(folder)
file$="some..."
while file<>""
file=ru(nextfile(dir))
wend

My ready program is serch paths in selected folder with some name, and function ru() is very much times happened in it :(

If this "bug" in maxgui and stadart libraryes, then need some method that will set codepage for all operations one time, on program start, and other functions will use correct codepage.

Before thanks for help :)


Brucey(Posted 2009) [#5]
BlitzMax strings are based on Unicode (2-byte characters).
If you want to enter text under a different codepage you will have to translate it first.

Windows also works, by default, in UTF-16, although you may have Windows-1251 enabled for text entry.