Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » unicode?

This thread is locked; no one can reply to it. rss feed Print
unicode?
hazul
Member #4,338
February 2004
avatar

I'm trying to use the 'ä' and 'ö' characters in my game (a and o with two dots on top).. but i'm only seeing a ' ^ ' character. Do i need to set unicode on or something? How do i do this?

* * * * *
"Multiplayer is actually the best way of not programming a good AI" -ReyBrujo

DanielH
Member #934
January 2001
avatar

Yes

Click below on AGDN and select Unicode example.

Mars
Member #971
February 2001
avatar

The Allmighty Documentation said:

By default, Allegro uses UTF-8 encoded text (U_UTF8). This is a variable-width format, where characters can occupy anywhere from one to six bytes. The nice thing about it is that characters ranging from 0-127 are encoded directly as themselves, so UTF-8 is upwardly compatible with 7 bit ASCII ("Hello, World!" means the same thing regardless of whether you interpret it as ASCII or UTF-8 data). Any character values above 128, such as accented vowels, the UK currency symbol, and Arabic or Chinese characters, will be encoded as a sequence of two or more bytes, each in the range 128-255. This means you will never get what looks like a 7 bit ASCII character as part of the encoding of a different character value, which makes it very easy to manipulate UTF-8 strings.

There are a few editing programs that understand UTF-8 format text files. Alternatively, you can write your strings in plain ASCII or 16 bit Unicode formats, and then use the Allegro textconv program to convert them into UTF-8.

Just use SciTE to write your code and save as UTF-8. That should do the trick.

--
This posting is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects.

Joel Pettersson
Member #4,187
January 2004

I had this problem too.
The solution I used was adding set_uformat(U_ASCII); to the program before allegro_init();.

hazul
Member #4,338
February 2004
avatar

Thanks, joel. That did the trick :)

* * * * *
"Multiplayer is actually the best way of not programming a good AI" -ReyBrujo

Go to: