List Info

Thread: unicode problem




unicode problem
country flaguser name
Belgium
2007-12-20 04:53:03
Hello all,

I use Pylons 0.9.6 with SQLAlchemy 0.4.1 and Genshi 0.4.4

I have a strange unicode dilemma ... :
- either I set sqlalchemy.convert_unicode = true in my
configuration
file and url_for fails with : exceptions.Exception: url_for
can only
return a string or None, got unicode instead:
/ias/pics/published.png
- either I don't set sqlalchemy.convert_unicode and then
Genshi fails
with : exceptions.UnicodeDecodeError: 'ascii' codec can't
decode byte
0xc3 in position 2: ordinal not in range(128)

Any idea how could I resolve this (other than str()
everything in my
template files ..) ? 

Thanks,
Julien

-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be

Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: jcigarulb.ac.be
biobel: http://
biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "pylons-discuss" group.
To post to this group, send email to pylons-discussgooglegroups.com
To unsubscribe from this group, send email to
pylons-discuss-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: unicode problem
country flaguser name
United States
2007-12-20 13:28:29
On Dec 20, 2007, at 2:53 AM, Julien Cigar wrote:

> I use Pylons 0.9.6 with SQLAlchemy 0.4.1 and Genshi
0.4.4
>
> I have a strange unicode dilemma ... :
> - either I set sqlalchemy.convert_unicode = true in my
configuration
> file and url_for fails with : exceptions.Exception:
url_for can only
> return a string or None, got unicode instead:
/ias/pics/published.png
> - either I don't set sqlalchemy.convert_unicode and
then Genshi fails
> with : exceptions.UnicodeDecodeError: 'ascii' codec
can't decode byte
> 0xc3 in position 2: ordinal not in range(128)
>
> Any idea how could I resolve this (other than str()
everything in my
> template files ..) ?

Go with the first option, and can you provide more details
on how  
you're calling url_for? Ensuring you're calling url_for
properly, and  
keeping everything unicode where possible is the best
solution.

Cheers,
Ben
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )