durusmail: quixote-users: Why not use UTF-8 by default
Why not use UTF-8 by default
2005-06-04
2005-06-04
2005-06-05
2005-06-05
Why not use UTF-8 by default
Damjan
2005-06-04
> Quixote, as it is now, makes too much (wrong) assumptions about strings
> being iso-8859-1, and I've written about it before.

One example, UTF-8 in PTL templates.

I've made two simple python modules for testing:
utftest1.ptl and utftest2.py

# utftest1.ptl
# -*- coding: utf-8 -*-
def test [html] ():
    u'кирилица' # <- cyrillic characters, utf-8 encoded

# utftest2.py
# -*- coding: utf-8 -*-
def test():
    return u'кирилица' # same here

And I'm testing them from an interactive python:
>>> from quixote import enable_ptl; enable_ptl()
>>> import utftest1, utftest2
>>> utftest1.test()

>>> utftest2.test()
u'\u043a\u0438\u0440\u0438\u043b\u0438\u0446\u0430'

See the difference? PTL has destroyed my original content.


--
damjan | дамјан
This is my jabber ID --> damjan@bagra.net.mk <-- not my mail address!!!
reply