• 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
Re: utf8 to NSString crasher
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: utf8 to NSString crasher


  • Subject: Re: utf8 to NSString crasher
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 2 Sep 2008 23:53:01 -0500


On Sep 2, 2008, at 9:42 PM, Clark Cox wrote:

On Tue, Sep 2, 2008 at 7:29 PM, Waqar Malik <email@hidden> wrote:
I am converting UTF8 string "Rø" to NSString using stringWithUTF8String: I
get nil as a return value:


(gdb) p utf8_str
$1 = "R\303", '\000' <repeats 253 times>

That is not a valid UTF-8 string. The UTF-8 encoding of "Rø" would be "R\303\270" (that is, you're missing a byte).

(gdb) po theString
Cannot access memory at address 0x0

Is there a canonical way to convert wchat_t to NSString?

And furthermore, you shouldn't be using wchar_t to store UTF-8. UTF-8 doesn't use wide characters. The utf8_str that you printed above may have the bytes in the proper order or it may not depending on endianness.


Cheers,
Ken_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >utf8 to NSString crasher (From: Waqar Malik <email@hidden>)
 >Re: utf8 to NSString crasher (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: [OT] curious about the iPhone dev program
  • Next by Date: process monitoring panic
  • Previous by thread: Re: utf8 to NSString crasher
  • Next by thread: Re: utf8 to NSString crasher
  • Index(es):
    • Date
    • Thread