HIGHCHARUNICODE directive (Delphi)
Go Up to Delphi Compiler Directives (List) Index
| 
 Type  | 
 Switch  | 
| 
 Syntax  | 
 {$HIGHCHARUNICODE ON} or {$HIGHCHARUNICODE OFF}  | 
| 
 Default  | 
 {$HIGHCHARUNICODE OFF}  | 
| 
 Scope  | 
 Local  | 
Remarks
The {$HIGHCHARUNICODE ON} directive controls the behavior of characters #$80 ... #$FF (#128 ... #255).
When HIGHCHARUNICODE is OFF:
- All decimal #xxx n-digit literals are parsed as AnsiChar.
 - All hexadecimal #$xx 2-digit literals are parsed as AnsiChar.
 - All hexadecimal #$xxxx 4-digit literals are parsed as WideChar.
 
When HIGHCHARUNICODE is ON:
- All literals are parsed as WideChar.
 
Example: 
In the following example:
- (U + 0080) is a control character; it is absent on ANSI codepages (converted to '?').
 - (U + 00C8) is 'È' character; it is present on the Win1252 codepage and absent on the Win1251 codepage (converted to 'E').
 
 var
   A: AnsiChar;
   W: WideChar;
 
 begin
 
 {$HIGHCHARUNICODE OFF}
   A := #$80; // Ord(A) = $80
   W := #$80; // Ord(W) depends on default ANSI codepage; for example
              //   = $0402 for Win1251 codepage ('Ђ')
              //   = $20AC for Win1252 codepage ('€');
 
 {$HIGHCHARUNICODE ON}
   A := #$80; // Ord(A) = $3F ('?')
   W := #$80; // Ord(W) = $80
 
   A := #200; // Ord(A) depends on default ANSI codepage; for example
              //   = $45 for Win1251 codepage ('E')
              //   = $C8 for Win1252 codepage ('È');
   W := #200; // Ord(W) = 200 ($C8) 
 
 end;