Re: Using entities for me dash problem
In article <BBFB12B2.10A0%subscriber@p...>, JCS <subscriber@p...> wrote: >Thanks, I'm aware of this, however, what I *don't* understand because it >makes no logical sense, is that if I'm transforming XML UTF-8 to UTF-8 my >declaration should be UTF-8, not something else. What I mean is, if I use >US-ASCII as an output method to preserve my NCR the declaration in the >output file should still be UTF-8, not ASCII, because it's NOT ascii but it >was *translated* using ASCII to preserve the NCR. Does this make sense? What >is it that *I'm* not getting, because it's very confusing. If an XML file contains — this means Unicode character 8212, which as you know is em-dash. The encoding of the file is irrelevant to this: the numbers in character references are always unicode code points regardless of the file encoding. The encoding of the file determines how the characters "&", "#", "8", "2", "1", "2", and ";" are represented, not what they mean. Once the XML document is parsed, there will just be the em-dash character, stored in the program's own internal encoding. The fact that it was once represented by a numeric character reference is forgotten. When the program comes to output the document, it will have to decide how to represent it. If the output encoding can represent the character (as UTF-8 can), it will probably just output it directly. If it can't (as ASCII can't) it will have to use a character reference. So you can force character references for non-ASCII characters by specifying ASCII as the output encoding. Remember that this is just a trick. If you really want to output the document as UTF-8, but with non-ASCII characters represented by character references, then you probably have to write your own code to do it. But since ASCII is a subset of UTF-8, any ASCII XML document can be converted to a UTF-8 version just by manually editing the encoding declaration. -- Richard
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format