Re: Cant't use UTF-8 source files. False string interpretation.
Re: Cant't use UTF-8 source files. False string interpretation.
- Subject: Re: Cant't use UTF-8 source files. False string interpretation.
- From: Clark Cox <email@hidden>
- Date: Mon, 16 Feb 2004 10:09:39 -0500
On Feb 16, 2004, at 08:42, Bernd Carl wrote:
>
Hello,
>
my problem is that I cannot programmaticaly apply international
>
characters to my nib file.
>
It is possible to enter arabic letters in an NSTextField by using IB's
>
Attributes window but I can't [text1 setStringValue:@"someArabic"];
>
Whenever I try to do so XCode tells me that I need to change the
>
document layout to UTF-8. Then it does work in XCodes editor but not
>
in my GUI.
>
My window produces the usual crap when it's trying to display UTF-8 in
>
an non UTF-8 environment.
You can use UTF-8 strings in UTF-8 source files only with the C string
syntax (i.e. "my UTF-8 string"), not with the Objective-C string syntax
(i.e. @"my NSString"), as the latter only supports 7-bit, ASCII. You
have two options here:
1) Use NSLocalizedString, and put your GUI strings in a .strings file
2) Use [NSString stringWithUTF8String: "My UTF-8 String"]
Option 1 is arguably better as it makes no assumptions about the
encoding of the source code, and it allows you to add other
localizations at a later date.
--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.