Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion How do I set my form to be a unicode string?

View Parsed - Show only message text

Received: by 10.35.124.20 with SMTP id b20mr1538292pyn.1183300059026;
        Sun, 01 Jul 2007 07:27:39 -0700 (PDT)
Return-Path: <walter....@gmail.com>
Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.182])
        by mx.google.com with ESMTP id v36si2715004wah.2007.07.01.07.27.38;
        Sun, 01 Jul 2007 07:27:38 -0700 (PDT)
Received-SPF: pass (google.com: domain of walter....@gmail.com designates 209.85.146.182 as permitted sender)
DomainKey-Status: good (test mode)
Received: by wa-out-1112.google.com with SMTP id m16so1887051waf
        for <pylons-discuss@googlegroups.com>; Sun, 01 Jul 2007 07:27:38 -0700 (PDT)
DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed;
        d=gmail.com; s=beta;
        h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
        b=pupX11UlrvkvuhpIdy7C3KPlQfeM9Go5kk2cjjcwwCPtpyN5GzZcH0MbjjBCiYPgnoBDVdrDRLEPgIVLQZMQnLBAcvGtREfsqa2guhEudKLoedaHmyuXZPKwa5jGfh6YowJXgxt4ochaYREju0TR7ICywvkQhL9LJRnbxNEs6ug=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=beta;
        h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
        b=ehh5J/a1GYe5TdIG6wC17WkUW8/HjFGa6HCwWzfD5TWPk6876zVDOox9dF8PrJSNHwMXi5rV9wBB70w6Ic3Bukf0GPFOi5hl50WwYdfV3oQu0vADTTFfTlBMhNaPJ+jfe2spKmefQWRC4pl+AX1r4Ocdzgqzo+NguvTIablyFE0=
Received: by 10.114.127.1 with SMTP id z1mr4315407wac.1183300058606;
        Sun, 01 Jul 2007 07:27:38 -0700 (PDT)
Received: by 10.115.22.7 with HTTP; Sun, 1 Jul 2007 07:27:38 -0700 (PDT)
Message-ID: <32cabba0707010727j420d3bbbo4f2fefec30f1357c@mail.gmail.com>
Date: Sun, 1 Jul 2007 11:27:38 -0300
From: "Walter Cruz" <walter....@gmail.com>
To: pylons-discuss@googlegroups.com
Subject: Re: How do I set my form to be a unicode string?
In-Reply-To: <20070701074607.GA4666@laptux.ov.otto.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
References: <32cabba0706300755s4c5857e1m35dcadd5ab563...@mail.gmail.com>
	 <20070701074607.GA4...@laptux.ov.otto.de>

Well, I asked before search the in the list archives!

What I needed:

    tmpl_options['mako.input_encoding'] =3D 'UTF-8'
    tmpl_options['mako.output_encoding'] =3D 'UTF-8'
    tmpl_options['mako.default_filters'] =3D ['decode.utf8']
    request_settings =3D dict(charset=3D'utf-8', errors=3D'replace')
    return pylons.config.Config(tmpl_options, map,
paths,request_settings=3Drequest_settings)

In environment.py

I changed my formencode validator to: UnicodeString and now it's ok.

But I'm with a doubt:

Even with this, in my templates I've to use:

${h.link_to(u"Nova cita=E7=E3o", h.url(action=3D"new"))}

(Note the u before "Nova cita=E7=E3o").

How can I configure this to avoid to say that this is string is unicode?

[]'s
- Walter

On 7/1/07, Christoph Haas <em...@christoph-haas.de> wrote:
>
> On Sat, Jun 30, 2007 at 11:55:25AM -0300, Walter Cruz wrote:
> > I'm getting this error:
> >
> > <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode
> > byte 0xc3 in position 79: ordinal not in range(128) the form was
> > passed in as an encoded string, but some data or error messages were
> > unicode strings; the form should be passed in as a unicode string
>
> Depends on where that error occurs. Can you post a complete traceback?
>
> > How do I set the form to be unicode?
>
> Use the
>
> # -*- coding: utf-8 -*-
>
> preamble in the first line of your templates.
>
>  Christoph
>
>
> >
>

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google