• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bug in Xcode, File Inspector lies to me.. (was: Re: How to construct Unicode Safe Strings in the source?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in Xcode, File Inspector lies to me.. (was: Re: How to construct Unicode Safe Strings in the source?)


  • Subject: Bug in Xcode, File Inspector lies to me.. (was: Re: How to construct Unicode Safe Strings in the source?)
  • From: Martin Häcker <email@hidden>
  • Date: Sun, 13 Jul 2003 13:24:05 +0200

An easier way to construct NSStrings from constant UTF-8 C-Strings is the following way:

NSString *string = [NSString stringWithUTF8String:"my utf8 encoded string"];

Thanks for the suggestion, I dunno how I could overlook this one.. :)

Now what really mystifies me is that each of this methods to get strings with the correct content _doesn't_ work in the other project! (Though I created them both by myself and today). The only difference being that the one is a foundation tool, while the other is a GUI app. File encodings are the same (utf8) in both cases, so thats out.

_What_ does not work?
Are you sure it is not just a problem with displaying the strings?
I think Terminal uses UTF-8 by default (so it should work fine therein), but I am not sure what encoding the built in console in Project Builder uses.

Well I narrowed it down to this:

[NSString stringWithUTF8String:"my utf8 encoded string"]
as well as my version
id data = [NSData dataWithBytesNoCopy: aCString length: strlen(aCString) freeWhenDone: NO];
[[NSString alloc] initWithData: data encoding:NSUTF8StringEncoding]

Both work perfectly in one project while in the other one stringWithUTF8String as well as initWithUTF8String as well as initWithData:encoding all return nil to me.

And I absolutely have no clue why.

WOW! I think I found it! It seems to be a bug in Xcode after all.

I always looked at the file inspector to determine if the file is propperly encoded (utf8) and it told me yes.

Now I changed that encoding (just for the heck of it) saved and changed it back and now everything works!

cu Martin
--
dont.wanna.tell
[ot]coder - hehe
_______________________________________________
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.

References: 
 >Re: How to construct Unicode Safe Strings in the source? (From: Manfred Lippert <email@hidden>)

  • Prev by Date: Re: getCString a good idea here?
  • Next by Date: Re: categories question...
  • Previous by thread: Re: How to construct Unicode Safe Strings in the source?
  • Next by thread: Re: getCString a good idea here?
  • Index(es):
    • Date
    • Thread