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/2002-January/019157.html below:

[Python-Dev] Unicode strings as filenames

[Python-Dev] Unicode strings as filenamesMartin v. Loewis martin@v.loewis.de
Fri, 4 Jan 2002 20:27:59 +0100
> Would it be safe to set site.encoding to utf8 on Mac OS X by default? 

As MAL explains, no. Instead, you should extend the fragment

#if defined(MS_WIN32) && defined(HAVE_USABLE_WCHAR_T)
const char *Py_FileSystemDefaultEncoding = "mbcs";
#else
const char *Py_FileSystemDefaultEncoding = NULL; /* use default */
#endif

to cover OSX as well, setting the string to "utf-8". Then, Unicode
objects will be auto-converted to UTF-8 in open() and all posixmodule
calls; not sure whether OSX uses posixmodule, though...

Once you've done this, you should use es# specifiers with
Py_FileSystemDefaultEncoding wherever you retrieve a file or path
name from the application.

Returning file names to the user is a different story, though: it may
or may not be sensible to apply the file system encoding (if set)
whenever file names are returned to the application (mostly in
listdir).

HTH,
Martin



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