[kupu-dev] UnicodeDecodeError with umlauts in image title

Tim Terlegård tim.terlegard at valentinewebsystems.se
Wed Jul 2 11:37:56 CEST 2008


Hi kupuers,

I get an error when I have an image with a title that contains umlauts
and use that image inside a document with caption enabled.

The error is triggered by the transform in html2captioned.py on these  
lines:

     if isinstance(data, str):
         data = data.decode('utf8')
     html = IMAGE_PATTERN.sub(replaceImage, data)

replaceImage returns utf8, so data should also be utf8, otherwise the  
sub()
method will fail when there are umlauts involved.

Things work if I remove the conversion to unicode on the line above.
I'm not sure why the conversion to unicode was added some months ago.
I have changed the tests to use umlauts and removed the conversion to
unicode. The tests pass. Should I commit this or is there something I'm
missing?

/Tim


More information about the kupu-dev mailing list