2005/5/10

     
 

String Encoding

artefaktur

ACDK supports Unicode strings with many encodings.


Content of this chapter:

   Interfaces
   Implementations
   Configure default encoding



 Interfaces

The class  acdk::locale::Encoder translates a String into a byte stream.
The class  acdk::locale::Decoder translates a String into a byte stream.

Both interfaces are available via the  acdk::locale::Encoding factory interface.
Using acdk::locale::Encoding::getEncoding(IN(RString) name) an encoding can be received by name.

 Implementations

Following encodings are currently available:
  • UTF8
  • UCS2: 2 bytes unicode character. Endianess is platform depending
  • UCS2-LE: 2 bytes little endian unicode character
  • UCS2-BE: 2 bytes big endian unicode character
  • US-ASCII: 7 bit ASCII
  • ByteAscii: 8 bit ASCII
  • 8859-1, LATIN-1, 8859-2, 8859-3, 8859-4, 8859-5, 8859-6, 8859-7, 8859-8, 8859-9, 8859-10, 8859-13, 8859-14, 8859-15, 8859-16: ISO code pages
  • CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1256, CP1257, CP1258, IBM-850, IBM code pages
  • C-Escape: Escapes non-printable chars as C-Escapes, like '\n' for new line.
  • AsciiUtf: US-ASCII with escapes for chars > 128 < '\uFFFF'.

Please refer to  String how to use unicode literals in the source code.

 Configure default encoding

At startup of an application ACDK tries to evaluate the locale from the underlying system.
This value can be overwritten either via configuration file or command line.
The default encoding will be used for example to read and write from a concole.

See  Runtime Configuration for more details.