Safari stores its cookies in XML format.  Looking to try and add support for
it to cookielib I started by first trying to parse it with Fredrik Lundh's
elementtree package.  It complained about an invalid token.  Looking at the
spot it indicated in the file, I found a non-ASCII, but (as far as I can
tell) perfectly valid utf-8 string.

I whittled the plist file down to what I've attached.  With it I get

    >>> e = elementtree.ElementTree.parse("Cookies.plist")
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
      File 
"/Users/skip/local/lib/python2.5/site-packages/elementtree/ElementTree.py", 
line 864, in parse
        tree.parse(source, parser)
      File 
"/Users/skip/local/lib/python2.5/site-packages/elementtree/ElementTree.py", 
line 588, in parse
        parser.feed(data)
      File 
"/Users/skip/local/lib/python2.5/site-packages/elementtree/ElementTree.py", 
line 1132, in feed
        self._parser.Parse(data, 0)
    xml.parsers.expat.ExpatError: not well-formed (invalid token): line 17, 
column 12

I had no trouble decoding that string as unicode.  Any ideas what's wrong?

Thx,

Skip

Attachment: binfeFbX4goN0.bin
Description: Binary data

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to