English 中文(简体)
UnicodeDecode Error with Jinja2 + GAE
原标题:UnicodeDecodeError with Jinja2 + GAE

我在试图把外国char子从一dict子中抹掉以下错误。 你们是否有任何想法?

File "/base/data/home/apps/s~montaoproject/cap.354503891062679364/main.py", line 333, in render_jinja
    self.response.out.write(template.render(data))
  File "/base/data/home/apps/s~montaoproject/cap.354503891062679364/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/base/data/home/apps/s~montaoproject/cap.354503891062679364/templates/list_jinja.html", line 199, in top-level template code
    {% for key,value in location_map_br_11_cap.items() %}<option value="3" >{{ value.name }}</option>{% endfor %}
UnicodeDecodeError:  ascii  codec can t decode byte 0xc3 in position 9: ordinal not in range(128)

我的变量是:

location_map_br_11_cap = {1: {
     name : str( Toda Região 11 (ddd) ),
     lat : -23.55,
     long : -46.64,
     radius : 294200,
    }, 2: {
     name : str( Todo Estado de São Paulo ),
     lat : -22.90,
     long : -43.21,
     radius : 294200,
    }, 1: {
     name : str( Toda região Sudeste do Brasil ),
     lat : -23.55,
     long : -46.64,
     radius : 294200,
    }}

我将抱着某种希望,努力实现这一目标:

location_map_br_11_cap = {1: {
     name : str( Toda Região 11 (ddd) ).decode( utf-8 ),
     lat : -23.55,
     long : -46.64,
     radius : 294200,
    }, 2: {
     name : str( Todo Estado de São Paulo ).decode( utf-8 ),
     lat : -22.90,
     long : -43.21,
     radius : 294200,
    }, 1: {
     name : str( Toda região Sudeste do Brasil ).decode( utf-8 ),
     lat : -23.55,
     long : -46.64,
     radius : 294200,
    }}
最佳回答

页: 1 因此,金贾知道如何在生成模板时加以编码。

问题回答

暂无回答




相关问题
How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

gqlQuery returns object, want list of keys

Is there a way to convert the GqlQuery object to an array of keys, or is there a way to force the query to return an array of keys? For example: items = db.GqlQuery("SELECT __key__ FROM Items") ...

Integrating Google AppEngine with a Thick Client

I want to make a multi-user client-server solution with Java Swing thick client as a front-end and Google AppEngine (Java one) as a back-end. The problem is that GAE provides only web-based forms for ...

sorl.thumbnail : thumbnail is not a valid tag library?

I am trying to install sorl.thumbnail but am getting the following error message: thumbnail is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module ...

热门标签