Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion UTF-8 output trouble in Mako with Pyramid
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Gimbel  
View profile  
 More options Apr 17 2012, 12:13 pm
From: Michael Gimbel <michael.gim...@rightbrainnetworks.com>
Date: Tue, 17 Apr 2012 09:13:33 -0700 (PDT)
Local: Tues, Apr 17 2012 12:13 pm
Subject: UTF-8 output trouble in Mako with Pyramid
Hi all.

I'm encountering MakoRenderingException and UnicodeDecodeError
exceptions throughout my application when trying to render utf8 data
which was originally user input.

There don't seem to be Pyramid configuration options for Mako's
output_encoding='utf-8', encoding_errors='replace'.

Python/Mako magic doesn't seem to be doing it either, ## -*- coding:
utf-8 -*-

I've tried using a mako filter, which helped: mako.default_filters =
decode.utf8 (in .ini file)
But I still have problems anywhere I'm using filters or functions in
my templates: ${var_with_utf8_chars | custom_filter}
This seems to fix it but I don't want to have to do this throughout
the entire application: ${var_with_utf8_chars.decode('utf8') }
custom_filter}

I was thinking if the above is the only way, the best place to do it
would be at the model level when the utf8 data is loaded out of the
database.  But I was hoping for a better, more magical solution.

Anyone have any ideas?

Thanks,
Mike


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.