Sign In/My Account | View Cart  
advertisement

Article:
 Hacking iTunes
Subject: Decoding the iTunes Music Library Location field
Date: 2009-11-05 05:56:42
From: garberfc

iTunes was complaining about some inconsistencies between itself and my external music library. So I wrote a program to cross check all the entries in the file iTunes Music Library.xml with my music library.


The full file specification for each song is in the field:
<key>Location</key><string>file://localhost/D:/CatAudio/Enya/Watermark/11%20Na%20Laetha%20Geal%20M'%C3%B3ige.mp3</string>


As you can see in the <string/> portion of the pair there are some 'funny' values that need translation. The values are always preceded by a percent (%) sign followed by two hexadecimal digits. These can be considered escape sequences for characters that don't lend themselves to XML data.


Most of the translations are pretty straight forward. Find a unicode chart like this one: http://www.ssec.wisc.edu/~tomw/java/unicode.html#x0000 An example is %20 translates to a space. The difficulty comes in with two specific codes: %C3 and %C2. These work like tuples. When either is encountered, the following three characters are ALWAYS another code. When a %C2 is encountered the following code can be directly converted. When a %C3 is encountered the hex value x40 must be added to the code, then translated to a character.


Good Luck!


Previous Message Previous Message   Next Message Next Message


Sponsored By: