Stack Exchange
Finding encoding of a string in XML
I am trying to find the encoding for the following xml piece:
<?xml version="1.0" charset="UTF-8">
<name>Lo-Ve[]lo</name>

Where [] is displayed as a box. The correct tag content would be Lo-Vélo. The point is that the content of the name tag is not UTF-8 encoded.
hexdump -C shows
00000000  3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e 3d 22 31  |<?xml version="1|
00000010  2e 30 22 20 63 68 61 72  73 65 74 3d 22 55 54 46  |.0" charset="UTF|
00000020  2d 38 22 3e 0a 3c 6e 61  6d 65 3e 4c 6f 2d 56 65  |-8">.<name>Lo-Ve|
00000030  01 6c 6f 3c 2f 6e 61 6d  65 3e 0a                 |.lo</name>.|
0000003b

So the original encoding of Lo-Velo should show the 0x65 0x01 as é.
I am trying to find out what the encoding of the artist name in line 299 of the broken XML at this URL 
is, so some countermeasures could be made.

charset="UTF-8" - or am I missing something?

Sorry, I edited the question for clarification. The xml document is exatransported as UTF-8 and the xml declaration says UTF-8. Lo-Vélo isn't displayed correctly, because it has been inserted from another encoding without conversion to UTF-8. I am trying to find that original encoding which would display the name tag contents as "Lo-Vélo"

As expected FF complains that the document returned by that URL is not a valid XML file. Maybe you should file support ticket with Last.fm to get it fixed.

Its a known bug, I want to help them to fix it

Looking at the response source it may have been written manually by a series of write statements. That is not a way to form an XML file. They should use appropriate API for the their framework, which should take care of encoding issues automagically. There is nothing you can do about it by reading already broken file.

I am also writing a last.fm API library, so it would be useful, because I then could correct the broken xml myself until last.fm gets it fixed
