Re: Patch for fvwm-menu-desktop to fix UnicodeDecodeError

2012-10-03 Thread Thomas Funk

Dan Espen wrote:
> Sorry this escaped my attention.
>
> The patch above intercepts a failure in printtext which does this:
>
> def printtext(text):
> print text.encode("utf-8")
>
> So if I understand the patch, it intercepts one failure to do utf-8
> encoding and tries using iso-8859-15 instead.
>
> Why is only that call to printtext subject to this failure?

Because wine applications create desktop files with another codepage
than linux apps do. The best solution was to decode the strings with
iso-8859-15 because this codepage has the most special characters as
all other codepages.


> Don't other calls to printtext using menu names share this problem?

No.


> Just wondering if it makes more sense to put the logic in printtext.

That was my first thought but the error occurs while calling printtext.
printtext expects unicode compliant strings (chars below ascii 127).
Perhaps we could made a decode function which brings the strings in the
correct format before sending to printtext. but only the wrong formated
strings need this function others not. The solution above was the smallest.


> How about just printing the text without encoding it, if encoding fails?

Doesn't work because print wants strings without signs above ascii 127 also.
See 
http://blog.codekills.net/2008/05/01/encoding-and-decoding-text-in-python-%28or---i-didn%27t-ask-you-to-use-the-%27ascii%27-codec!-%29/

again.


Thomas



CVS dane: * fvwm-menu-desktop.in: Unicode support from Thomas Funk.

2012-10-03 Thread cvs
CVSROOT:/home/cvs/fvwm
Module name:fvwm
Changes by: dane12/10/03 09:59:38

Modified files:
bin: Tag: branch-2_6 ChangeLog fvwm-menu-desktop.in 

Log message:
* fvwm-menu-desktop.in: Unicode support from Thomas Funk.