cpstrnew branch (was Re: [fpc-devel] Freepascal 2.4.0rc1 released)

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Nov 12 00:01:45 CET 2009


On 11 Nov 2009, at 23:54, Tomas Hajny wrote:

> Are character sets recognized by numeric values under Mac OS X?

There are two ways to deal with them. One is libiconv, like on any  
*nix platform (which, afaik, only supports string identifiers). The  
other is CFString, which uses numeric values: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/doc/constant_group/External_String_Encodings

Mac OS X also has some helper routines that they (and we) may use  
though (especially the second and the fourth one):

CFStringConvertEncodingToIANACharSetName
CFStringConvertEncodingToWindowsCodepage
CFStringConvertIANACharSetNameToEncoding
CFStringConvertWindowsCodepageToEncoding

I didn't know about them until I looked up the CFString reference.

It's quite unfortunate that the new unicodestring type that Delphi  
added isn't opaque, since then we could just have used CFString on Mac  
OS X (instead of constantly creating and destroying CFStrings when we  
have to convert from one code page to another).


Jonas



More information about the fpc-devel mailing list