discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specifying unicode strings


From: Richard Frith-Macdonald
Subject: Re: Specifying unicode strings
Date: Sun, 23 Sep 2001 14:37:18 +0100

On Sunday, September 23, 2001, at 01:54 PM, Aurelien wrote:

I'd want to specify an UTF string in my program, like they do in java:

String s = " \u0000\u0001\u0002";

Is there something similar in objc or am I forced to use something like initializing the string from a file,... ?

Well - that wpould need compiler support ... which may or may not exist in gcc-3 (you'd have to read
the codumentation to find out).

However, one trick is to make use of the fact that quoted strings in property-lists have unicode escape
sequences using \U ...

String s = [@"\" \\U0000\\U0001\\U0002\\"" propertyList];

The propertyList method converts a text-based property-list representation to it's internal format ... So the literal string needs leading and trailing '\"' sequences to be a quoted string, and the backslashes within the string must be quoted to allow for the normal quoting performed by the
compiler.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]