RAD Studio (Common)
ContentsIndex
PreviousUpNext
HIGHCHARUNICODE directive (Delphi)
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;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!