cs1.6
cs1.6

Reputation: 159

parse xml with objective c

i have problem when i parse xml because i have this caracter ö

<?xml version="1.0" encoding="UTF-8"?>
        <rsp stat="ok">
                <mediaid>abösjdk3</mediaid>
                <mediaurl>http://twitöic.com/abc123</mediaurl>
        </rsp>

the building:

parser error : Input is not proper UTF-8, indicate encoding !
    Bytes: 0x9A 0x74 0x68 0x65
             <mediaid>ab\232sjdk3</mediaid>
                      ^

other question please if want parse this > 6 < 12 month i will have problem,i not want replace > samone have solution?

Upvotes: 1

Views: 737

Answers (2)

alloc_iNit
alloc_iNit

Reputation: 5183

Go through this, it will help...

Upvotes: 0

Paulo Santos
Paulo Santos

Reputation: 11567

You'll have this problem with any parser, not only with objective-c.

That character isn't encoded as UTF-8 and as such it will halt any parser.

Either remove the encoding information or change for the correct value.

Edited to answer a comment

i use GDataXmlNode to parse and in my xml file i not use <?xml version="1.0" encoding="UTF-8"?> – cs1.6

IF the original XML file does not have the encoding attribute, then either when you instantiate the parser, or load the XML file, inform the proper encoding, which I have no idea what it is.

Because for the way that the O.P. is posted, it implies that the character ö is encoded as \232. However, the decimal 232 in ISO-8859-1 represents the character è. The character ö is represented as \246.

Upvotes: 5

Related Questions