Re: non-ASCII characters in CFString literal [Was: (no subject)]
-
On 11 Jul 2006, at 17:29, Ivan C Myrvold wrote:
> I get the following warning when I tries to use norwegian
> characters. How can I avoid the warning?
>
> [[row validateInput] setObject:@"Du har skrevet inn feil navn i
> Utføres av!" forKey:@"utforesav"];
>
> warning: non-ASCII character in CFString literal
Have a look at stringWithUTF8String
Example of use:
NSString *myString = [NSString stringWithUTF8String:"%
ƒÂÚÂÎßÛ†–ƒ∆\n"];
-António
-----------------------------------------
Accepting others as they are
brings a wonderful freedom
to your own mind.
--The Peace Formula
----------------------------------------- -
On Jul 11, 2006, at 10:40 AM, Antonio Nunes wrote:
> Have a look at stringWithUTF8String
>
> Example of use:
> NSString *myString = [NSString stringWithUTF8String:"%Äåòåë§ó ÐÄÆ\n"];
Which, by the way, only works if the source file is being saved as
UTF-8 by the text editor. It'll most likely blow up if it's saved
using any other encoding. I think Xcode defaults to saving source
files using MacRoman. NSLocalizedString() or unichar arrays are
really the way to go to put non-ASCII characters into NSStrings.
Nick Zitzmann
<http://www.chronosnet.com/> -
Is this a good way to do it too?
[NSString stringWithFormat:@"This char is non-ASCII: %C", 0xC5]
dkj -
Right or wrong, that's how I've done it, though I can't do much about
the several thousand warnings I periodically get from the framework.
Tony
3 Cats And A Mac
On Jul 11, 2006, at 5:24 PM, D.K. Johnston wrote:
> Is this a good way to do it too?
>
> [NSString stringWithFormat:@"This char is non-ASCII: %C", 0xC5]
>
> dkj
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<Cocoa-dev...>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<tonycate...>
>
> This email sent to <tonycate...>
-
On 11 Jul 2006, at 17:29, Ivan C Myrvold wrote:
> I get the following warning when I tries to use norwegian
> characters. How can I avoid the warning?
>
> [[row validateInput] setObject:@"Du har skrevet inn feil navn i
> Utføres av!" forKey:@"utforesav"];
>
> warning: non-ASCII character in CFString literal
This is clearly a FAQ item - the list archives is full of threads on
this topic!
My favourite, and the most authoritative, post from the list archive
is this one:
<http://www.cocoabuilder.com/archive/message/cocoa/2005/3/30/131791>
j o a r



