wchar in ansilib
Jean-Michel BRUCK (3009) 362 posts |
Hello, Perhaps it is better to use Unicode library? Thanks |
Rick Murray (539) 13850 posts |
Most likely, yes. Wide character encodings were designed to deal with things like Asian characters before the adoption of Unicode – such as Shift-JIS and the like. Ironically wide encodings don’t specify any actual format, only that characters are represented by multiple byte encodings… The size of which is compiler specific. Wide character support could, I suppose, be pressed into use for UTF-16, however if I was going to use Unicode on RISC OS, I would use the one most compatible with existing code – namely UTF-8 where a string is still a string in C1, all you need to understand and support is a break from the idea that 1 byte = 1 character. Luckily the UTF-8 encoding is both simple to understand and gives it’s byte length (normally 1 to 4 bytes, but can be 1-6) as a part of itself. The challenge, of course, is getting the Wimp to do something sensible with the text. While the machine can be switched to UTF-8 and it all magically works, the side effect is that everything else (assuming Latin1) breaks. As a Frenchie you’d see all your accents disappear. And, no, I don’t expect fruity things like switching out fonts to support inline Cyrillic, Greek, kana, etc – that probably requires changes in FontManager for what might be a very narrow use case mais d’avoir des mots dans différents encodages qui semblent les mêmes sur l’écran and not with missing accents (other languages use twiddly bits over characters and they aren’t there as a fashion accessory like the umlaut in the names of certain metal bands) just because the alphabet is different… That is something the Wimp should do.2 1 UTF-16, on the other hand, represents most English text as a character followed by a null, which would need continual special handling due to C treating a null as a string terminator. 2 But, then, I’m well known as the sleeping monster that gets poked whenever something mentions Unicode and RISC OS in the same sentence. ;-) I probably would have ranted more had I a keyboard instead of a tiny screen to write this on. ;-) |
Jean-Michel BRUCK (3009) 362 posts |
Thanks Rick for these clarifications. The € is difficult to get, is it the reason for Brexit :) |
Jean-Michel BRUCK (3009) 362 posts |
Hello, </TaàTRé> |