Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread glenn andreas


On Apr 21, 2008, at 8:35 AM, Ewan Delanoy wrote:



 [theButton setTitle:[NSString stringWithFormat:@Put a n with a
tilde,like this : %c,0X00F1]];

Unfortunately, at runtime the exotic character is displayed  
incorrectly:

it appears as
a breve (Unicode character number 02D8 instead of 00F1).



You want %C, not %c (%c is character, while %C is unicode character).

Glenn Andreas  [EMAIL PROTECTED]
 http://www.gandreas.com/ wicked fun!
quadrium | flame : flame fractals  strange attractors : build,  
mutate, evolve, animate




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Ewan Delanoy


 %c is interpreted at runtime according to the default string
 encoding for that process. This depends on what the user's preferred
 language is set to, but for English and most European languages it's
 MacRoman. That choice makes sense for backward-compatibility reasons,
 but nowadays it tends to be mostly an annoyance.

 So it's definitely best to stick to Unicode-based mechanisms, like %C.

 (By the way, in 10.5, GCC now allows you to use non-ascii characters
 in string literals right in your source code. So there's no need to
 construct a string with an ñ in it programmatically, as long as you're
 building with Xcode 3.0.)

   Thanks for your very complete explanation (btw, I did not know
about being allowed to use Unicode directly in Xcode 3.0; that's a nice
improvement!). I read it just after sending
another post in that thread, unnecessarily in fact
since your explanation already answers eveything in the post.

 Ewan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Jean-Daniel Dupas


Le 21 avr. 08 à 16:48, Jens Alfke a écrit :



On 21 Apr '08, at 6:35 AM, Ewan Delanoy wrote:


It seems clear that this is a conflicting encoding issue, but between
which encodings?
coming from where? (The default file encoding is Unicode UTF-8 in  
the
Xcode preferences, and it seems there is no item to deal with  
encodings in

the Interface Builder's preferences)


%c is interpreted at runtime according to the default string  
encoding for that process. This depends on what the user's preferred  
language is set to, but for English and most European languages it's  
MacRoman. That choice makes sense for backward-compatibility  
reasons, but nowadays it tends to be mostly an annoyance.


So it's definitely best to stick to Unicode-based mechanisms, like  
%C.


(By the way, in 10.5, GCC now allows you to use non-ascii characters  
in string literals right in your source code. So there's no need to  
construct a string with an ñ in it programmatically, as long as  
you're building with Xcode 3.0.)




What will be the output encoding in this case ? GCC generate utf-8 or  
it uses the source file encoding ?



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Conflicting encodings issue in a Cocoa app

2008-04-21 Thread Aki Inoue
(By the way, in 10.5, GCC now allows you to use non-ascii  
characters in string literals right in your source code. So there's  
no need to construct a string with an $(D+P(B in it  
programmatically, as long as you're building with Xcode 3.0.)




What will be the output encoding in this case ? GCC generate utf-8  
or it uses the source file encoding ?


Regardless of GCC binary C string encoding settings, the content of  
constant CF/NSStrings are stored in UTF-16 in this case.


So, as long as your file encoding matches the GCC's file encoding  
setting (see -finput-charset) which is default to UTF-8, it just works.


Aki
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]