[I18n-sig] sys.(set|get)_string_encoding in 1.6

M.-A. Lemburg mal@lemburg.com
Thu, 07 Sep 2000 18:30:11 +0200


Tamito KAJIYAMA wrote:
> 
> Hi,
> 
> I found that sys.(get|set)defaultencoding() defined in the
> Unicode proposal version 1.6 were implemented with different
> names sys.(get|set)_string_encoding() in the 1.6 final release.
> Is this an intended change?  If so, why is this incompatibility
> introduced?

These APIs were first introduced as experiment to the CVS tree
under the names you find in the 1.6 release. They were meant
to provide an easy way to experiment with different default
encodings. 

After some discussions on python-dev the outcome
was to keep the APIs for use by site.py to set a locale
dependent default encoding. 

This idea was then retracted some weeks later and replaced
with the now standard ASCII default encoding which you find
in both 1.6 and 2.0.

So to answer your question: the sys APIs in 1.6 are to be
considered undocumented features and should *not* be used.

I haven't followed the 1.6 release too closely and didn't
even realize that these APIs made it into the release
version... things were moving much too fast at the time and
I was busy with 2.0. Sorry :-/

Python 2.0 will have the sys APIs which are documented in
the Misc/unicode.txt file:

        getdefaultencoding() -> string
        
        Return the current default string encoding used by the Unicode 
        implementation.

        setdefaultencoding(encoding)

        Set the current default string encoding used by the Unicode
        implementation. Only available in site.py.

Also see the disabled code in site.py for details on how
to reenable the locale dependent default encodings.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/