tags:

views:

96

answers:

1

Hi,

i am trying to display characters like £ on a device which runs under linux . it is using utf-8 charset format . when i get to display a string which contains special characters, it displays other characters too . if i print the string on the console it appears ok, but when i parse the string to load each letter font on the screen it gets weird and the output is not the correct one .

Has anyone experienced something like this or is able to give me some advice .

Thank you.

A: 

If the string is in UTF-8, you need to use call such as TTF_RenderUTF8_Solid(). Thats for True Type Fonts.

If you have your own fonts and glyphs for your fonts, then you need to convert your UTF-8 string into to UTF-16 (most commonly used) or UTF-32 (in case of i18n support) and then use it to index into the glyph table.

You can't parse individual bytes of your utf-8 string into a valid character, when the font crosses the ASCII limits.

Refer these code snippets: http://unicode.org/faq/utf_bom.html

thank you, i will give it a try now .
seven