• 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: how decode xml utf-8 string into nsstring??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how decode xml utf-8 string into nsstring??


  • Subject: Re: how decode xml utf-8 string into nsstring??
  • From: Dustin Voss <email@hidden>
  • Date: Wed, 30 Jun 2004 11:54:08 -0700

On 29 Jun, 2004, at 2:05 AM, Emmanuel Verlynde wrote:

i give characters from internet with initWithContentsOfUrl method but i can't
decode
utf8 characters to printable characters with i`to... characters...

<?xml ... encoding=="UTF-8">
<firstname>st\u0300phaine \u0302\u030a</firstname>

Can you help me?

I try initWithUTF8String, initWithCString, initWithBytes and encoding strings
constants, ... but no results.

It is not clear what you are asking, but I will tell you right now that that fragment of XML (which I assume you wrote) is wrong in five ways. Let's start with the first line. It should look like

<?xml ... encoding="UTF-8"?>

Note that, FIRSTLY, there is a question mark in the closing angle bracket, and SECONDLY, the "encoding" attribute, like all attributes, has only one equals sign. THIRDLY, you have to either add

standalone="yes"

to the "<?xml?>" processing instruction, or add a "<!DOCTYPE>" instruction that specifies a DTD. FOURTHLY, XML documents must have a root tag, which contains all other tags. It looks like you intend to have a structure like

<firstname>...</firstname>
<lastname>...</lastname>

which would be incorrect. There would be two root tags. It should be like

<person>
<firstname>...</firstname>
<lastname>...</lastname>
</person>

which has only one root tag, "<person>". FIFTHLY, since the file says it is in UTF-8, those Unicode characters can be entered directly. But if you did want to use a literal character escape, you would not use "\u030A" -- that is for C. You would use "&#x030A;", like in HTML.

If you are getting this file from someone else, then go to their house and kick their ass, because they do not know w.t.f. they are doing.
_______________________________________________
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: 
 >how decode xml utf-8 string into nsstring?? (From: "Emmanuel Verlynde" <email@hidden>)

  • Prev by Date: Forwarding to Super
  • Next by Date: Re: Binary data
  • Previous by thread: how decode xml utf-8 string into nsstring??
  • Next by thread: Move data between applications? (NSDragOperationMove)
  • Index(es):
    • Date
    • Thread