PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Read(readLine) for non-english characters

Hi! I'm using localised Russian WM2005 image for emulator and eglish text loads perfectly as usual from ANSI document, but russian is not with both read or readLine functions. Is it normal on current project
state?
Hi ryumaster,

That`s right we are not reading unicode files at this moment.

The read functions reads bytes, and the readLine function reads bytes as asciis. For utf-16 files, you need to read two bytes to get a character.

This could be an interesting feature: adding support for reading unicode text files. I will bring the issue in the next GledPlay development team meeting. Meanwhile you can add your idea in the wishlist post.

http://www.pocketmatrix.com/forums/viewtopic.php?t=25119
Hi!

Try this solution.

Make stadart text file in MS Windows notepad. Make shure that it was saved using 1251 codepage (russian language codepage) and in signle byte for single char format.

Then in your program read every CHAR c (1 byte unsigned) from this file, and convert it using:
Code:

TCHAR tc;
MultiByteToWideChar( 1251, MB_USEGLYPHCHARS, &c;, 1, &tc;, 1 );


Then add this converted char to your buffer.

I think you can read and convert more then 1 character at a time, but this method worked fine for me, so I stoped mine researching at this point.

P.S. I haven't try this with GledPlay yet, but I think it must work. You may encounter some difficulty to make GledPlay font system display your text, but I think with the right method of attack to this problem you'll be able to handle it.
Looks very intresting. Tnx, Nomad! I'll try to make it work with GledPlay in my project.

Yai, I managed to get it working.

Code:
while ( (readBytes = textFile.readLine(buffer, 1)) > 0 )
{

tempforconvert[j] = (LPCSTR)buffer;
MultiByteToWideChar(1251, MB_USEGLYPHCHARS, tempforconvert[j], 1, &megax;[j], 1 );
j++;

}

If anyone gonna use unicode, don't forget to convert buffer from TCHAR to LPCSTR like I did.