ANSI / Unicode Mode

Web Site

All platforms have Str class support for ANSI characters (8-bit).  Some platforms (currently Windows, and soon Linux with gcc) also have support for Unicode.

When an application uses Str Library, it must choose the native mode for Str Library.  This can be achieved by defining one of the two conditional symbols:

	#define STR_ANSI
	#define STR_UNICODE

If neither is defined, the library itself will choose a default mode according to the following rule:

Based on this definition, Str Library will declare the STRCHAR type to be equivalent to char or wchar_t Most methods of the Str class that accept C-style strings use the const STRCHAR* type.

There are some operations that Str Library can handle with both Unicode and ANSI characters no matter what mode was chosen.  For example, a string object can be concatenated with either an ANSI or a Unicode string. However, this will involve a character conversion "behind the scenes" which will have an effect on performance.

Str Library does not have built-in support for MBCS (multi-byte character set) strings. This would require adding a large amount of code, and programming with MBCS is difficult anyway. We recommend using Unicode instead.

In certain cases, Unicode support may not be required and might only add unnecessary code to the compiled executable. This can be avoided by declaring

	#define STR_NO_UNICODE

When this symbol is defined, all Unicode support is stripped from the library, resulting in a smaller footprint after compilation.

See alsoStr conditional defines, STRCHAR type