How to handle CDATA in XMLReader

I continue to struggle in Xojo with XML containing unicode characters outside the ASCII range.

Xojo sends the following request…

data = socket1.Get("http://"+Host+"/chaos/lookup_Student?"+get, 30) data = defineEncoding(data, encodings.UTF8)

The database server is sending the following xml…

[quote]<?xml version="1.0" encoding="UTF-8"?>

<rsrchPlan_Equipment></rsrchPlan_Equipment>

[/quote]

If I view data in the debugger I see…

[quote]<?xml version="1.0" encoding="UTF-8"?>

<rsrchPlan_Equipment></rsrchPlan_Equipment>
[/quote]

And, when I pass data to XMLReader…

Dim reader As New myXMLReader reader.Parse(data)

The reader throws an exception when it hits the ¼ character.

Ok. I can get this all to work with or without wrapping the value in CDATA by encoding the ¼ with ¼

I had hoped that by using CDATA I would not have to encode the ¼ character or any other non ASCII character. I thought that was what CDATA was all about.

I must be missing something pretty simple here.

Thanks,

John

Are you sure you are receiving UTF8?

Try pulling the data out of the cdata block first and then call DefineEncoding on that.

Thanks for the responses. I had been asked several times while trying to answer my questions regarding UTF8 encoding… Are you sure you are recieving UFT8. I always assumed I was as I was creating it myself in the database server.

Turns out I was not. Actualy 2 settings were required. In Xojo I had to call defineEncoding(data, encodings.UTF8) and in the database server UTF-8 had to be set as the standard set for web text conversion. At first I had neither set properly. Then it looks like I had xoxo set proper but not the database server. Once I got them both set properly all my troubles went away. Except for the standard XML escaped character requirements I no longer have to encode any unicode characters.

I am good to go. Thanks to everyone who tried to help along this path.

John