Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 4th, 2006, 11:35 PM
John A Grandy
Guest
 
Posts: n/a
Default encoding type for existing .xml doc

How to determine the encoding type for an existing .xml doc ? UTF8 , 1252 ,
etc.


  #2  
Old August 5th, 2006, 02:15 AM
Mark Doerbandt
Guest
 
Posts: n/a
Default Re: encoding type for existing .xml doc

John A Grandy:
Quote:
How to determine the encoding type for an existing .xml doc ?
UTF8 , 1252 , etc.
mainly guess! ;-)

What's needed:

http://groups.google.com/groups?thre...%40tkmsftngp04

For UTF-8 and UTF-16 see

http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8

.... especially the part on BOM.

Mark
  #3  
Old August 5th, 2006, 02:45 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: encoding type for existing .xml doc



John A Grandy wrote:
Quote:
How to determine the encoding type for an existing .xml doc ? UTF8 , 1252 ,
etc.
If the encoding is anything but UTF-8 or UTF-16 then the XML document
should have an XML declaration at the beginning declaring the encoding e.g.
<?xml version="1.0" encoding="Windows-1252"?>
Of course it is allowed to use the XML declaration for UTF-8 or UTF-16
too but if it is not there the XML parser is supposed to detect it using
the presence/absence of a fitting BOM, see
<http://www.w3.org/TR/REC-xml/#charencodingfor details.

Whether it is XML or HTML or some other text it is in general not
possible to determine the encoding of a document without there being
some declaration (e.g. XML declaration in XML, <metaelement in HTML)
or external information (e.g. HTTP Content-Type header with charset
parameter) that describes the encoding.



--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles