Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » UTF-8 Russian text output

This thread is locked; no one can reply to it. rss feed Print
UTF-8 Russian text output
Sancha
Member #14,714
November 2012

Is this the correct approach in order to output text in Russian?
How do I convert the char string into ALLEGRO_USTR*
Any help appreciated?

al_draw_ustr(myFont, color, xPos, yPos, NULL, "веков");

weapon_S
Member #7,859
October 2006
avatar

Although I haven't used it yet, I believe you either use al_ustr_new or al_ref_cstr. Maybe Allegro handles UTF-8 internally, even if you don't use the USTR functions.
In any case also make sure your source file's encoding is UTF-8

Sancha
Member #14,714
November 2012

Perfect! Thanks.

al_draw_ustr(myFont, color, xPos, yPos, NULL, al_ustr_new("веков"));

Saved source file (MSVC2010) using encoding: Unicode (UTF-8 without signature) - Codepage 65001

torhu
Member #2,727
September 2002
avatar

Should work with simply al_draw_text too, Allegro 5 always treats strings as being UTF-8.

Peter Wang
Member #23
April 2000

And al_ustr_new allocates memory.

Go to: