troubleshooting Question

DELPHI XE - ClientDataSet problem with Unicode chars in XML file

Avatar of moonrisesystems
moonrisesystems asked on
12 Comments1 Solution5381 ViewsLast Modified:
I have an simple XML file with 2 fields - Name and  Value.  I am looking to use this XML file like a database table i.e. locate values based on name, and update values based on name as well.  I have code that does all of this using a TClientDataSet, and XMLTransFormProvider, the two .xtr files defining the 'ToDataPacket' and 'ToXML' transformations.  I also have a TDataSource tied to a DB Grid to display the records.  Everything works fine until I hit a name/value record in which the value field contains unicode characters.  In this case, the TDataSet returns the single byte representation '??????' rather than the actual unicode chars.  Strangely enough, when I WRITE to the file replacing a value with a unicode string, it correctly goes into the xml file, but still will not be 'read' out and be displayed correctly.

The xml file is a Unicode file with a little endian BOM and displays correctly in IE.  I have tried both including and not including 'encoding="UTF-16" in the header.  The clientdataset has the fields defined as ftWideString.  The xtr files also have defined the fields as 'string.uni' both in the DataPacket and XML xtr files.

What am I missing?  There is probably a simple answer to this, but you know how things are after staring at something for a while...!

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros