On Tue, Jan 09, 2007 at 10:25:15PM +0100, Georg Baum wrote:
> Am Dienstag, 9. Januar 2007 22:19 schrieb Enrico Forestieri:
> 
> > No, I didn't try your patch.
> 
> That does not help :-( Your script works for me, too. The strange thing is 
> that the type of document.body[i] is neither a normal string nor a unicode 
> string. At least the error messages seem to suggest that.

I was compiling. Now I tried it. The TypeError is due to this statement:

  unicode(document.body[i], 'utf8')

I noticed that the error occurs when document.body[i] is empty, but even
after taking care of this it still occurs, so maybe it is due to some
wrong encoding. I am using the following trick to debug, maybe it can
be of help to you as I really don't know what I should expect:

import os
...

    for i in range(numberoflines):
        if (document.body[i] == ''):
            continue
        os.system(r'zenity --info --text="(%s)"' % document.body[i])
        unistring = unicode(document.body[i], 'utf8')
        result = unicodedata.normalize("NFKD", unistring)
        document.body[i] = result.encode('utf8')
...

-- 
Enrico

Reply via email to