[TxMt] dialog.py UTF-8 problem

Alex Ross ajross at cs.pdx.edu
Fri May 30 02:58:13 UTC 2008


On May 29, 2008, at 11:18 AM, Hans-Jörg Bibiko wrote:

> Dear dialog.py developer,

Hello.

> I'm not a python programmer but I'm just learning ;)
>
> I believe that dialog.py's method "menu" fails if I call it with a  
> list of strings which is encode in UTF-8 (i.e. the string contains  
> non-ASCII characters)
>
> What I did:
>
> ...
> suggestions = list(list(unicode(grepout.read(), "UTF-8"))[2:])
> ...

Just a tip here...

a_list[2:]  returns a list, so the second list call is redundant.

> suggestions contains a list of Unicode characters. Fine.
> suggestions[3] etc. can I insert in TM's document perfectly.
>
> But:
>
> result = dialog.menu(suggestions)
>
> fails.
>
> Did I something wrong or is this an issue of dialog.py?

dialog.py didn't support unicode.  I have made a couple changes that I  
think should fix you're problem.  Let me know if it works now!

–Alex


More information about the textmate mailing list