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.
According to [1], the config/environment.py value is overridden by the
browser's Content-Type header. From wireshark, I can see that my
browser is sending "Content-Type: application/x-www-form-urlencoded" -
I don't see any mention of UTF-8 encoding there, but I don't totally
know what that means.
What's more perplexing is that despite the environment.py settings to
use ISO-8859-1, and my HTML settings that are shipping ISO-8859-1,
PasteServer's HTTP headers still say "Content-Type: text/html;
charset=UTF-8"!
What do I have to do to really prevent Unicode from showing up in my
variables? Hopefully, I don't have to wrap every string in my app
with str()...
[1] http://pylonshq.com/docs/en/0.9.7/tutorials/understanding_unicode/
--
Ross Vandegrift
[email protected]
"If the fight gets hot, the songs get hotter. If the going gets tough,
the songs get tougher."
--Woody Guthrie
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---