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: "%s", cstring]




> Date: Thu, 18 Aug 2011 17:02:31 -0300
> From: wilkerlu...@gmail.com
> To: cocoa-dev@lists.apple.com
> Subject: Safe way to convert C String to NSString
> 
> 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 my case I really don't care about these characters, if I can just remove
> non-ascii from C String and them convert to NSString will be fine for me.
> 
> What you guys suggest in order that I can convert it to NSString, even
> losing non-ascii chars, but keeping others? Or a good way to guess the
> encoding and convert property?
> ---
> Wilker LĂșcio
> http://about.me/wilkerlucio/bio
> Kajabi Consultant
> +55 81 82556600
> _______________________________________________
> 
> 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/shashaness%40hotmail.com
> 
> This email sent to shashan...@hotmail.com
                                                                                
  _______________________________________________

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 arch...@mail-archive.com

Reply via email to