Re: [AD] exunicod and endianess |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> Sort of... you have effectively chosen not to support UTF-16BE on big-endian
> platforms but rather UTF-16LE. Note that this might be a sensible decision
> according to http://zsigri.tripod.com/fontboard/cjk/unicode.html but we need
> to clearly acknowledge it.
I have very little knowledge of unicode formats; you link actually enlighted
me a bit :)
On the same page it is said UTF-16LE is more widely used than the BE
version, so maybe it wouldn't hurt much if go with it only. Just a thought.
Or we could support both; it'd just be another little unicode vtable AFAIK
(but I don't know the Allegro unicode routines much).
> You got caught by the integer promotion rule:
>
> [#1] When a value with integer type is converted to another
> integer type, if the value can be represented by the new
> type, it is unchanged.
>
> This means that (char)(-1) is promoted to (int)(-1), not (int)(255), assuming
> char is a signed type. In other words, signed types are sign-extended by the
> promotion so bit7 of the char is replicated in bit8-bit31 of the int, which
> breaks your code.
D'oh!
> The attached patch works for me on x86 and should probably work for you too.
Yes, it fixed the issue :)
Now it displays everything correctly (exunicod.c from cvs)
> If so, I would be puzzled as to why fixing only exunicod doesn't work... How
> did you transform
>
> char message_it[] = "B\x00" "e\x00" "n\x00" "v\x00" "e\x00" "n\x00" "u\x00"
> "t\x00" "i\x00" " \x00" "a\x00" "d\x00" " \x00\x00\x00";
>
> for example?
When I did it, it looked like:
char message_it[] = "\x00B" "\x00e" "\x00n" "\x00v" "\x00e" "\x00n" "\x00u"
"\x00t" "\x00i" "\x00 " "\x00a" "\x00d" "\x00 \x00\x00";
--
Angelo Mottola
a.mottola@xxxxxxxxxx