[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Identifying the encoding of a document
On Mon, 7 Aug 2000, (Lisa Retief) wrote: > I am after the guidelines for identifying which encoding to use for a > particular document. I realise it depends on the characters included in the > document, but when you have megabytes of data that you yourself did not > code, this is kind of difficult to do. Are there tools that will do this for > you? Is there a fixed set of rules to follow so that I can build it inot my > application? I'm not exactly sure what you're asking... If it's: What encoding [character set] should I create new documents in? I suggest looking at two things. First, what character set is the data currently in? (or what character set are you used to working in?). Then ask what character set(s) does your (or your customer's) XML parser support? The answer to those questions will help determine what character sets to use. The majority of the XML parsers out there support UTF8, UTF16 and Latin1 (and US-ASCII) at least. Some support many more. Some very lightweight ones don't even support Latin1. I don't know if you're looking at African language support, or which character sets those languages use - but that might help determine the choice. On the other hand, if you've already got a document, and you're asking: How can I programmatically determine which character set an XML document is encoded in? There are probably several answers, but John Cowan posted a C function that could determine this very easily to this list a while back (OK, like 2 years ago probably) which you can probably still find somewhere, and I converted that to a Perl module for Apache, but which can actually be used outside of Apache (Apache::MimeXML is its name and can be found on the CPAN at http://search.cpan.org/). -- <Matt/> Fastnet Software Ltd. High Performance Web Specialists Providing mod_perl, XML, Sybase and Oracle solutions Email for training and consultancy availability. http://sergeant.org | AxKit: http://axkit.org
|
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
|