Hi guys,
I'm having some trouble by trying to convert a C String to NSString, I'm
currently using:
NSString *mystring = [NSString stringWithUTF8String:cstring];
But I don't know which encoding the string is using... And when it has some
latin or other kind of characteres, the return is nil.
In
On Aug 18, 2011, at 1:02 PM, Wilker wrote:
I'm having some trouble by trying to convert a C String to NSString, I'm
currently using:
NSString *mystring = [NSString stringWithUTF8String:cstring];
But I don't know which encoding the string is using... And when it has some
latin or other
On Aug 18, 2011, at 2:02 PM, Wilker wrote:
Hi guys,
I'm having some trouble by trying to convert a C String to NSString, I'm
currently using:
NSString *mystring = [NSString stringWithUTF8String:cstring];
But I don't know which encoding the string is using... And when it has some
latin
If the C strings are being read in from a file, you can use the
stringWithContentsOfFile:usedEncoding:error: or
initWithContentsOfFile:usedEncoding:error: methods which will
try to guess the encoding and return the string and the encoding
it used back to you. But even these methods are just
On Aug 18, 2011, at 1:02 PM, Wilker wrote:
But I don't know which encoding the string is using... And when it has some
latin or other kind of characteres, the return is nil.
In my case I really don't care about these characters, if I can just remove
non-ascii from C String and them convert
The Shawn solution worked really well for me :)
In my case I'm hacking an Zip library that I'm using, this zip library has
problems when inside the zip the name of files are using crazy encodings...
In my case, all I need to know about the file name is it extension (this is
why I don't care
On Aug 18, 2011, at 1:22 PM, Wilker wrote:
I did some hacks on it, using the [NSString stringWithFormat:%s, theString]
and it worked as I needed :)
Yikes — you should never, ever use ‘%s’ with NSStrings, unless you’re certain
that the C string is 100% ASCII. The reason is that the
Sorry here is the Shawn solution he used, I did not post to list the first time
:*)
From: shashan...@hotmail.com
To: wilkerlu...@gmail.com
Subject: RE: Safe way to convert C String to NSString
Date: Thu, 18 Aug 2011 16:11:45 -0400
have you tried:
[[NSString alloc] initWithFormat