HIGHCHARUNICODE directive (Delphi)
From RAD Studio
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.
When HIGHCHARUNICODE is OFF:
- All #$xx 2-digit literals are parsed as AnsiChar.
- All #$xxxx 4-digit literals are parsed as WideChar.
When HIGHCHARUNICODE is ON:
- All #$xx 2-digit and #$xxxx 4-digit literals are parsed as WideChar.
Example:
var
A: AnsiChar;
W: WideChar;
begin
{$HIGHCHARUNICODE OFF}
A := #$80; // A is $80
W := #$80; // W is $20AC
{$HIGHCHARUNICODE ON}
A := #$80; // A is converted to '?' ($3F) after narrowing it down from WideChar to AnsiChar
W := #$80; // W is $80
end;