Re: what to do with this string \u00fb\u2013
Re: what to do with this string \u00fb\u2013
- Subject: Re: what to do with this string \u00fb\u2013
- From: Nir Soffer <email@hidden>
- Date: Tue, 14 Nov 2006 22:21:23 +0200
To recode such string you can use something like this:
const char *cString = [stringToRecode
cStringUsingEncoding:NSASCIIStringEncoding];
if (cString == NULL)
// The string contained some non ascii characters
...
NSString *recodedString = [NSString stringWithCString:cString
encoding:NSNonLossyASCIIStringEncoding];
if (recodedString == nil)
// The string was ASCII, but not a NSNonLossyASCIIStringEncoding
...
You don't need core foundation for this unless you deal with huge
strings.
On 14/11/2006, at 04:55, Ricky Sharp wrote:
On Nov 13, 2006, at 8:17 PM, Jesse Grosjean wrote:
I'm trying to debug a "corrupted" string. The string was archived
as readable text (or at least it was supposed to have been) in a
dictionary but when it's unachieved the NSString has this content:
\u00fb\u2013\u00dc\u00c1,Ub7\u2026...
If your string actually contains what you typed above (i.e. a
slash, lower-case 'u', etc.) then I believe that string has been
encoded with kCFStringEncodingNonLossyASCII. Such an encoding uses
7-bit ASCII characters to represent all Unicode code-points.
To work with the CF string encodings, you can use
CFStringConvertEncodingToNSStringEncoding to map them to an
appropriate NSStringEncoding.
I realize that it's probably an encoding problem, but I'm not
really sure what the best way to turn those codes into normal text
is.
Can someone give me a hint of how to turn an NSString with the
above content into an NSString with readable text content?
As to if it will be readable, I agree with John Stiles in that it
appears to be garbage.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
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
Best Regards,
Nir Soffer
_______________________________________________
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