XML export reserved characters

I'm a complete newbie with very limited coding experience...with a simple problem. So I appreciate any and all patience and help.

Here is my problem: When I export into an xml, reserved characters are showing up funny.
Example(s): "For his about-to-be-released autobiography, �My Life�" & "I don�t see it as a problem"

First question: What code do I need to cancel out reserved characters?
Second question: Where do I put this code?

Again, thank you for helping a guy who feels like a complete idiot for not figuring this out for himself.


Please.....can someone give me a quick answer to this?

  1. How do you create the xml file?
  2. Give us an impression of your "Mp3tag export to xml" script file.
  3. Show us the first script line of the Mp3tag xml export script.
  4. Using what application do you see the crippled output characters?
  5. Read the manual about character encoding option when using $filename().
  6. Set the character encoding for the xml data, e. g.
<?xml version="1.0" encoding="ISO-8859-1"?>
  1. Hide illegal characters from the XML parser by using the term CDATA, e. g.


Thank you so much for your help on this, it is GREATLY appreciated. I will try and answer these to the best of my limited ability and please feel free to ask more questions in detail if need be.

  1. Create xml = I made a (not so good) template via mp3tag
    2/3/6. Script =
<?xml version="1.0" encoding="utf-8"?> $loop(%songpath%) $loopend()
  1. I use FLASH to parse the xml into a datagrid and it works fine except for the reserved chcaracters.
  2. I will look in the manual after this email, thanks for the heads-up
  3. I will try the CDATA insertion as soon as possible.

Again, thanks and I hope what I've provided gives you some insight.


This export script creates a xml file which will be displayed correctly in XML Notepad.

$filename(O:\TEST\Test1.xml,utf-8)'<?xml version="1.0" encoding="utf-8"?>'

If this is not the right way to go ... and you want to escape characters like "<", ">", "&" and so on, then you need somewhat of a html encoding function to encode e. g. "<" to "<".
You can build your own html encoder by using Mp3tag function $replace.


To fake the forum posting renderer I had to use the surrogate character sequence "&_" instead of simple "&", so remove the underline characters from the above code line when using it in reality.
Same for the following export script.

$filename(O:\TEST\Test2.xml,utf-8)'<?xml version="1.0" encoding="utf-8"?>'

The last export script will give oiutput like the following lines ...

<?xml version="1.0" encoding="utf-8"?>
  <song path="O:/TEST/T1/Divers ~ 00 ~ Genre ~ Electronic - Minimal-Tech House/02.mp3" title="I'm an Old Cowhand from the Rio Grande" artistname="Old Cowhand" time="00:00" source="&quot;For his about-to-be-released autobiography 'My Life'&quot; &amp; &quot;I don't see it as a problem&quot;. " verbatim="Rio Grande" topic="" notes="" />


Hi again DetlevD,

Thank you so much for all your help. I ended up using the 2nd script you wrote (longhand) and it worked for what I needed. I was trying to import xml CDATA into PHP and it got 'angry' with any approach I did.

I did have another quick question. Is there a way to change the default field names in the tag panel? I know I can add more fields if needed but I wanted to check if I can change the originals in a .ini file or something.

Again, thank you so much for your time!


I am glad to hear this.

I know nothing about it.