3.2.2 WideChar

Free Pascal supports the type WideChar. A WideChar is exactly 2 bytes in size, and contains one UNICODE character in UTF-16 encoding.

A unicode character can be specified by its character value (an UTF-16 code), by preceding the ordinal value with the number symbol (#).

A normal ansi (1-byte) character literal can also be used for a widechar, the compiler will automatically convert it to a 2-byte UTF-16 character.

The following defines some greek characters (phi, omega):

Const  
  C3 : widechar = #$03A8;  
  C4 : widechar = #$03A9;

The same can be accomplished by typecasting a word to widechar:

Const  
  C3 : widechar = widechar($03A8);  
  C4 : widechar = widechar($03A9);