187 views
in GUI Development by

Hello,

in short, I am searching for the best way converting ASCII strings coded in different codepages my subsystem creates to use correctly in an embedded wizard gui.

All of the strings in my subsystem are built out of char arrays coded in different codepages (ISO-8859-1, ISO-8859-2, ISO-8859-9, windows-1251, ...). 

To use these strings in embedded wizard, I have to convert them via the function:

XString EwNewStringAnsi( const char* aAnsi )

to the 16bit wide coded embedded wizard strings. At this point, the localization is lost and I am searching for an easy way to create the correct 16bit character codes for the localized char array. 

- Using the built in font resource and localization tools seem to force me to write substitution tables for all of the codepages I use. The same can of course also be done programatically in a hand made method.

- My second thought was using localized ttf font resources for each codepage, but localization of the ttf fonts seems also to be a hard task

So at the end, before writing substitution tables for all of the codepages, is there another way doing the conversion?

Greetings

MJaeggle 

 

1 Answer

0 votes
by

Hello MJaeggle,

I would recommend to prepare tables to convert between codepage specific 8-bit values and the corresponding UNICODE code points. Each table would consists of 256 entries a 16-bit. In total 512 bytes. It will thus not have a large impact on the binary size. The performance should also be very good. The main difficulty is the content of such table. Eventually, you can generate such tables by using other tools (e.g. PHP, C API, etc.)

Generally, Embedded Wizard stores all characters as UNICODE code points. Support for conversion from dedicated codepages is not available. The function EwNewStringAnsi() simply copies the 8-bit values as 16-bit values without applying any conversion steps on the values. The approach with localized TTF will not work. When converting a font, Embedded Wizard already uses UNICODE to address the glyphs.

Does it help you further?

Best regards

Paul Banach

by
Hello,

thank you for the answer. I started to write conversion functions between the unicode and the 8-bit codepage characters. I was able to find a set of tables in the format 8-bit -> 16-bit unicode characters for all common codepages which hopefully minimizes the overall work. So at the end, this seems to be the best solution.

Greetings

MJaeggle

Embedded Wizard Website | Privacy Policy | Imprint

...