Amarok may save invalid xml playlists

Jeff Mitchell kde-dev at emailgoeshere.com
Sun Oct 21 15:50:48 UTC 2007


On Saturday 20 October 2007, Miguel Angel Alvarez wrote:
> El Sábado 20 Octubre 2007, Jeff Mitchell escribió:
> > On Friday 19 October 2007, Miguel Angel Alvarez wrote:
> > > Hi all,
> > > The saved playlist may not be valid xml, containing escaped non-utf8
> > > characters which in turn will cause parsers to fail.
> > > See this bugreport for replaygain someone sent me, and have a look at
> > > the attached playlist in line 1551:
> > >
> > > Traceback (most recent call last):
> > >   File
> > > "/home/yoda/.kde/share/apps/amarok/scripts/amarok_replaygain/amarok_rep
> > >la yg ain.py", line 1095, in <module>
> > >     PlayList.update()
> > >   File
> > > "/home/yoda/.kde/share/apps/amarok/scripts/amarok_replaygain/amarok_rep
> > >la yg ain.py", line 877, in update
> > >     xmlparser.parse(str(amarok_dcop.playlist.saveCurrentPlaylist()[1]))
> > >   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py",
> > > line 109, in parse
> > >     xmlreader.IncrementalParser.parse(self, source)
> > >   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/xmlreader.py",
> > > line 123, in parse
> > >     self.feed(buffer)
> > >   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/expatreader.py",
> > > line 220, in feed
> > >     self._err_handler.fatalError(exc)
> > >   File "/usr/lib/python2.5/site-packages/_xmlplus/sax/handler.py", line
> > > 38, in fatalError
> > >     raise exception
> > > xml.sax._exceptions.SAXParseException:/home/yoda/.kde/share/apps/amarok
> > >/c ur rent.xml:1551:51: reference to invalid
> > > character number
> > >
> > > This is not actually a problem for me, since the affected parts are not
> > > of interes for replaygain and I have already written a workaround, but
> > > for other people this may be a more severe problem.
> >
> > Miguel--
> >
> > Here's line 1551:
> >
> > <Directory>/music/from iTunes/Virginia Jetzt!/Anf&#xdbff;&#xdee4;nger
> > Deluxe (Tour Edition)</Directory>
> >
> > Can you explain what's actually wrong with this?  I don't know what
> > character it's supposed to be, or why escaping it is invalid.
>
> It is the german character a-umlaut (ä), encoded in ISO8859-1 i think
> I'm not an xml expert, in fact I find it quite confusing, but it seems you
> can't put any character encoded in any encoding different from what the xml
> file encoding claims to be or the sax parsers will throw an error and stop
> parsing .
>
> > I can tell you that the problem, whatever it is, is likely in xmlEncode
> > in metabundle.cpp, starting at line 1512.

I wonder if this is a problem in Qt then.  The QTextStream is set to have a 
UTF-8 encoding, and each character is read and encoded if necessary, but the 
value to be encoded is gotten through:

uint uc = (*cur)[i].unicode();

So it should be a character represented as a unicode id that is converted to a 
base 16 number.

--Jeff



More information about the Amarok mailing list