3.2.2 WideChar

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

A Unicode character can be specified by its codepoint (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 codepoint.

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);