Strange behavior of stringWithFormat and accented characters
Strange behavior of stringWithFormat and accented characters
- Subject: Strange behavior of stringWithFormat and accented characters
- From: Olivier Mergault <email@hidden>
- Date: Mon, 24 Oct 2005 21:38:28 +0200
Hi Everyone,
I am new to cocoa and making a small coredata application in which I
have a controller in order to gather and print many informations.
My first try was successful but as I am learning, I have a lot of
repetitive code. So I started a new version of the controller — more
concise — and here is what's happening :
This is my code in the two controllers — in the old one, working, as
well in the second one, with a strange behavior :
NSString *movieDramatic = [movieController
valueForKeyPath:@"selection.dramatic"];
NSString *movieThematic = [movieController
valueForKeyPath:@"selection.thematic"];
NSString *output = [NSSTring stringWithFormat:@"Proposition
Dramatique : %@\nProposition Thématique : %@.",
movieDramatic, movieThematic];
As you can see (I hope), there is an accented letter in the @"" part
of the string ("é" on "Thématique").
With the first controller, every thing is OK : the accented letter is
here as expected. In the second one, the accented letter is replaced
by two characters ("√©") — a typical encoding problem !
In the debbuger, I can read the values; right in the first
controller, wrong in the second. The problem occurs in the last line
of this code. And movieDramatic and movieThematic are strings that
contains lot of accented letters which are output as expected.
Cleaning the target doesn't do any good.
So, what's going wrong ?
The only thing *new* is that I have downloaded the new version of
XCode (2.2) and work with it.
Is there some 'preferences' that I have not set ?
Has anyone an idea ?
Thank you.
Olivier
PS. Sorry for my poor english… _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden