[twill] non-ascii data?

Chris Abraham cabraham at openplans.org
Thu Mar 12 12:16:22 PDT 2009


Titus,
These issues are new to me too :)

I thought of a few options, however:
- you could just state that all twill scripts are interpreted as utf-8
- you could allow for a magic encoding comment at the top of the  
twill script, similar to the way python and mako does it:
http://www.python.org/dev/peps/pep-0263/

But maybe just passing the raw binary data through is fine.  Perhaps  
other people have better solutions.  As I said, I have a limited  
perspective on these issues :)

Thanks,
Chris


On Mar 12, 2009, at 10:24 AM, C. Titus Brown wrote:

> On Thu, Mar 12, 2009 at 10:14:23AM -0400, Chris Abraham wrote:
> -> Hi,
> -> I've been wondering about how to set twill variables to non-ascii
> -> values.  I have just been using just binary representations like:
> -> setglobal event_name    'Flunc Test Party n ?????? N'
> -> versus
> -> setglobal event_name    'Flunc Test Party n \346\227\245\346\234 
> \254 N'
> -> or
> -> setglobal event_name   u'Flunc Test Party n \u65e5\u672c N'
> ->
> -> Doesn't the binary representation leave things open to
> -> interpretation?  I mean, how does twill know how to decode this
> -> value?  Does it assume utf-8?  Is there a way to specify what
> -> encoding a particular value is in?
>
> Those are good questions; it just treats them as Python strings being
> entered on the terminal, I think, so probably utf-8.  I must admit to
> being at sea on these issues...
>
> Would it work to allow an optional unicode encoding as the last
> argument?
>
> --titus
> -- 
> C. Titus Brown, ctb at msu.edu




More information about the twill mailing list