|
|
Classification: |
C++ |
Category: |
Debugging |
Created: |
04/27/2000 |
Modified: |
06/07/2001 |
Number: |
FAQ-0492 |
Platform: |
Symbian OS v6.0, Symbian OS v6.1 |
|
Question: Are there any simple ways to test that my application is correctly supporting Unicode characters - I have to do some conversion
between Unicode and 8-bit characters and I want to ensure that I'm testing the cases where nontrivial Unicode characters are
encountered.
Answer: The most convenient way to test support for Unicode characters with values greater than 256 is to use the Euro symbol.
The Unicode encoding for the Euro is 0x20AC (decimal 8364), and it is supported in the standard EPOC fonts. The CodePage 1252 encoding for the Euro is 0x80 (decimal 128) and it is supported in some Windows TrueType fonts, and in
the EPOC encoding used with the narrow builds (ER5 and before).
Both EPOC and Windows file systems can support file names involving the Euro, and the Euro can be entered from the keyboard
by means of a control sequence: Unicode EPOC: Press and hold the CTRL key, type the digits 8 3 6 4, then release the CTRL key Windows NT: Press and hold the ALT key, type the digits 0 1 2 8 on the numeric keypad, then release the ALT key
When converting from Unicode into UTF8, the Euro should be translated into the 3-byte sequence 0xE2 0x82 0xAC - note that
the final 0xAC is a coincidence and not simply the low byte of the Unicode character!
As an example of how the Euro symbol improves the testing, it should be noted that the descriptor functions
TDes8::Copy(const TDesC16& aDes) TDes16::Copy(const TDesC8& aDes)
do not do proper character conversion, and will corrupt the Unicode Euro value into 0xAC, which is the Unicode and CP1252
encoding for ¬ ( NOT SIGN ).
|
|
|