i've somehow got a unicode error on production, where data may come from
any one of a number of sources. it's going to be a pain to replicate this
on dev.
The traceback i'm generating isn't helping much at all (see below). does
anyone have a suggestion on how to get better logging and track
I managed to reroute this specific url to an alternate view for testing,
and enabled variables one-at-a-time in the template to find the error.
The issue was this:
- mako template included call to a library to write meta-data on it
- the meta-data had some encoding issues
- mako didn't show any
Thank you, Jonathan - this line in my development.ini makes the mako
templates use the utf8 decoder:
mako.default_filters = decode.utf8
... and for the pyodbc+mssql utf8 issue, the trick seemed to be to use
Python 3.2 instead of 2.7 (I didn't try others), then this got the data
decoded from
Hello,
I'm new to Pyramid, and I'm having a tough time getting the encodings all
lined up. Here are my components:
pyodbc
mssql (I don't have a choice)
mako
sqlalchemy (declarative)
Here's the end of the stack trace I'm seeing:
File c:\code\vision\bws\bws\templates/projects.mako, line 14, in
I've done more searching and reading, and I seem to have 2 separate issues:
1. The data isn't being returned as utf-8
The x92 byte code I mentioned in my original post is for a 'smart
apostrophe', and the Python strings are being created as CP1252 bytes
instead of UTF-8. I've tried various
mako has some render settings that are configurable in the .ini file
http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html#mako-template-render-settings
the encode/decode error is a complete pain in the ass. i've run into it
many times.
a helper function I've used
Hi Brian,
yes you can change the encoding on paypal's end. Look here:
Profile My Selling Tools Paypal button language encoding More options
And select utf8 on both popups.
On Sunday, 17 June 2012 22:42:16 UTC-4, Brian wrote:
I have a pyramid 1.2 application which processes donations made
Blaise,
Unfortunately, I do not have access to the Paypal encoding settings.
I'm tracking donations made to an account I do not own.
So, I need to be able to accept windows-1252 encoding in my pyramid app.
Is there a way I can decode and re-encode the request.body before it's
parsed into the
From my unaccepted SO answer.. AFAIK it's correct though.
http://stackoverflow.com/a/11061308/704327
Pyramid supports a request factory. You can use this to decode the request.
def request_factory(environ):
req = pyramid.request.Request(environ)
return req.decode(charset='gbk')
Using Pylons 0.9.5 with Kid I get a unicode error from formencode when
I have a non-ascii character in my template (copy; in this case).
Looking ath the data based to formencode kid returns the template
as a utf8-encoded string, while formencode (htmlfill.py
line 234) really wants a unicode
10 matches
Mail list logo