Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Bob Swart (aka Drs.Bob) Dr.Bob's Delphi Clinics Dr.Bob's Delphi Courseware Manuals
View Bob Swart's profile on LinkedIn Drs.Bob's Delphi Notes
These are the voyages using Delphi Enterprise (and Architect). Its mission: to explore strange, new worlds. To design and build new applications. To boldly go...
Title:

Unicode tip #6 - Character Literals

Author: Bob Swart
Posted: 12/1/2008 5:38:28 PM (GMT+1)
Content:

Character literals between #128 and #255 – the so-called high ASCII values – have a specific value depending on the ANSI code page. As a result, we should not use the #128..#255 character literals, but use the actual characters themselves which will end up as Unicode characters in the source code.

  (*$HIGHCHARUNICODE OFF*)
With the HIGHCHARUNICODE set to OFF, we can define the high-ASCII values without them turning into Unicode characters.
  (*$HIGHCHARUNICODE OFF*)
var
C: AnsiChar;
begin
C := #128;
Without turning HIGHCHARUNICODE OFF, we would get a warning that the #128 character, actually WideChar constant #$0080 (based on the current active code page), would have to be narrowed from WideChar to AnsiChar.

This tip is the 6th in a series of Unicode tips taken from my Delphi 2009 Development Essentials book published earlier this week on Lulu.com.

Back  


No Comments, yet.


New Comment (max. 2048 characters, no HTML):

Name:
Comment:



This webpage © 2005-2014 by Bob Swart (aka Dr.Bob - www.drbob42.com). All Rights Reserved.