[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Identifying the encoding of a document

  • From: Matt Sergeant <matt@s...>
  • To: "(Lisa Retief)" <lisa@e...>
  • Date: Mon, 07 Aug 2000 10:45:13 +0100 (BST)

determine document encoding
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/).


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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.