Re: [BUGREPORT] broken comments.py

Michael Guntsche <mike-Z92qn3yYq0hWk0Htik3J/[email protected]> Mon, 13 Oct 2008 08:01:27 +0200
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <8bee3069c9e7df4f7e4f8aeebf87b906@localhost>
On Mon, 13 Oct 2008 04:48:11 +0200, "Joern P. Meier" <[email protected]>
wrote:
> Hi,
> 
> Ryan Barrett schrieb:
>> thanks for looking into this, guys! i'm cc'ing joern meier, who sent
>> in the original patch. joern, mind helping with this?
> 
> Hmm, two things come to mind:
> 
> 1) Don't encode unless the object passed in is unicode. If it is a plain
> string, it already should be encoded in some encoding urlencode can deal
> with (or rather: doesn't care about ;)). 
> 
> 2) If you use a patched comments.py with an unpatched comments.js, it
> may not work, since the original comments.js doesn't encode UTF-8
> correctly.

Apparently this happens during the reading of the comment from the file, so
I do not think that urlencode is the culprit here. Nevertheless this error
points in the direction of a string object being encoded. Why?

if you encode a string object it is first decoded to Unicode and then
encoded again. Looking at the comment it does not make any sense at all,
since all the values SHOULD be unicode objects anyway AND even if it is a
str it is only ASCII in this example. 

Klaus please try one more thing. In comments.py line 997 replace
"types.StringTypes" with "types.UnicodeType". This makes sure that we only
encode unicode strings.

I am out of the office starting today so I won't have much time during the
next days to further debug this.

/Mike
 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/