in reply to XML File Encoding and Parsing Problem

I believe the degree sign holds different locations in ISO-8859-1 and UTF-8. If you output ISO-8859-1 and call it UTF-8 then you are going to have problems (unless every character you use happens to hold the same location).

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) is probably worth a read.

So is perldoc perluniintro

  • Comment on Re: XML File Encoding and Parsing Problem

Replies are listed 'Best First'.
Re^2: XML File Encoding and Parsing Problem
by graff (Chancellor) on Mar 08, 2006 at 00:11 UTC
    If I understand what I think you're trying to say here:
    you are going to have problems (unless every character you use happens to hold the same location)

    that is actually a little misleading. UTF-8 encoding is designed such that, in order for "every character you use ... to hold the same location", the file must consist entirely of byte values below 0x80 -- that is, it must be a pure ASCII file. (And if that is the case, then technically, the file is UTF-8, because ASCII data is a proper subset of UTF-8 data.)

    If text is encoded in any character set other than utf8 (e.g. any ISO-8859, or CP12*, or whatever) and includes anything outside the ASCII 7-bit table, then there is no way whatsoever, if you try to treat that data as utf8, for any of those wide characters to come out as "the same character".

    In other words, there is no wide character defined in utf8 such that the sequence of bytes representing that utf8 character is identical to the bytes representing the same (linguistic) character in any non-unicode encoding.

Re^2: XML File Encoding and Parsing Problem
by merrymonk (Hermit) on Mar 08, 2006 at 09:21 UTC
    Thanks for the information and link. I get the strong
    impression that the root of the problem is that
    the degree sign has been written as such.
    I belevie its 'number' is greater than 0x80 which is causing thigs to fail.