A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-January/107512.html below:

[Python-Dev] Import and unicode: part two

[Python-Dev] Import and unicode: part twoJames Y Knight foom at fuhm.net
Thu Jan 20 01:11:52 CET 2011
On Jan 19, 2011, at 6:44 PM, Toshio Kuratomi wrote:
> This problem of which encoding to use is a problem that can be
> seen on UNIX systems even now.  Try this:
> 
>  echo 'print("hi")' > café.py
>  convmv -f utf-8 -t latin1 café.py
>  python3 -c 'import café'
> 
> ASCII seems very sensible to me when faced with these ambiguities.
> 
> Other options I can brainstorm that could be explored:
> 
> * Specify an encoding per platform and stick to that.  (So, for instance,
>  all module names on posix platforms would have to be utf-8).  Force
>  translation between encoding when installing packages (But that doesn't
>  help for people that are creating their modules using their own build
>  scripts rather than distutils, copying the files using raw tar, etc.)
> * Change import semantics to allow specifying the encoding of the module on
>  the filesystem (seems really icky).

None of this is unique to import -- the same exact issue occurs with open(u'café'). I don't see any reason why import café should be though of as more of a problem, or treated any differently.

It's reasonable to recommend that people use ASCII in their module names if they want wide portability, but it should still be supported to use non-ASCII.

James
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4