On Mar 6, 2009, at 2:34 PM, Ross Vandegrift wrote:
>
> Hi everyone,
>
> One of my app's primary functions is to speak SNMP to routers and
> switches. This completely precludes the use of any Unicode -
> something
> that's getting very frustrating in Python (not just Pylons!)
>
> I've got:
> config['pylons.request_options']['charset'] = None
> config['pylons.response_options']['charset'] = 'iso-8859-1'
> in my config/environment.py.
>
> But I still have request.params being passed up the stack with
> everything as Unicode. Here's one example:
>
> UnicodeMultiDict([('location', u'2'), ('domain', u'2'), ('hostcount',
> u'6'), ('customer', u'a'), ('type', u'2'), ('description', u'a'),
> ('ttype', u'srt'), ('nexthop', u'172.16.0.4'), ('vlanmethod',
> u'auto'), ('vlan', u'0'), ('interface', u'Vlan99')])
>
> I didn't see this behavior until 0.9.7. I've also tried setting
> config['pylons.request_options']['charset'] = "US-ASCII", but the data
> comes through the same.
This should work:
config['pylons.request_options']['charset'] = None
Maybe you don't have this line at the end of the environment.py? It
should come after config.init_app
You can check request.charset later for what this is actually set to.
Only the value of None should disable unicode (US-ASCII won't).
--
Philip Jenvey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---