Re: cString vs UTF8String (memory question)
Re: cString vs UTF8String (memory question)
- Subject: Re: cString vs UTF8String (memory question)
- From: John Timmer <email@hidden>
- Date: Fri, 12 Dec 2003 15:45:13 -0500
>
In short, my question is, can I basically go through my code and
>
replace all calls to -cString or -lossyCString with calls to
>
-UTF8String instead? Are there going to be any unforeseen consequences?
>
(In my case the only C strings I work with tend to be filesystem paths,
>
for which I am already using -fileSystemRepresentation, and arguments
>
to command-line tools.)
Just a word of warning on doing this arbitrarily - in downloading some web
page info, using UTF8String would mostly work, but occasionally return nil,
leading to sporadic crashes in my app. I wound up having to use
initWithData: encoding: and use NSISOLatin1StringEncoding in order to make
sure that something was consistently generated.
If it had failed every time, it would have been easy to diagnose, but the
erratic nature caused me headaches, so I thought a warning was in order...
Cheers,
JT
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.