self-hosting repo available
zindar at gmail.com
Mon Apr 11 10:45:37 BST 2005
On 11 Apr 2005 11:41:27 +0200, Lele Gaifax <lele at nautilus.homeip.net> wrote:
> >>>>> "Erik" == Erik Bågfors <zindar at gmail.com> writes:
> Erik> Thanks lele. You are right. It gives me ascii. Should
> Erik> python take this from locale? It's all UTF-8 there?
> Erik> : [bagfors at zyrgelkwytng]$ ; locale LANG=sv_SE.UTF-8
> As said, this depends on the system setup for Python. You didn't
> mention which distro you're using, but you should be able to locate
> either an /etc/python/site.py or an equivalent somewhere under the
> /usr/lib/python2.3/ tree.
> It should contain a call to sys.setdefaultencoding(). Debian does it
> this way:
> encoding = "ascii" # Default value set by _PyUnicode_Init()
> if 1: ## <------- THIS is 0 by default
> # Enable to support locale aware default string encodings.
> import locale
> loc = locale.getdefaultlocale()
> if loc:
> encoding = loc
> if 0:
> # Enable to switch off string to Unicode coercion and implicit
> # Unicode to string conversion.
> encoding = "undefined"
> if encoding != "ascii":
> # On Non-Unicode builds this will raise an AttributeError...
> sys.setdefaultencoding(encoding) # Needs Python Unicode build !
I'm on ubuntu and your first "if 1:" is "if 0:" I consider this a bug
since hoary is UTF8 per default.
I'll see if there is a bug open on this.
More information about the bazaar