Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fab96cc

Browse files
committed
Add NEWS item for new string methods.
1 parent 30324a7 commit fab96cc

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@ What's New in Python 2.2a0?
33

44
Core
55

6+
- Strings now have a new method .decode() to complement the already
7+
existing .encode() method. These two methods provide direct access
8+
to the corresponding decoders and encoders of the registered codecs.
9+
10+
To enhance the usability of the .encode() method, the special
11+
casing of Unicode object return values was dropped (Unicode objects
12+
were auto-magically converted to string using the default encoding).
13+
14+
Both methods will now return whatever the codec in charge of the
15+
requested encoding returns as object, e.g. Unicode codecs will
16+
return Unicode objects when decoding is requested ("���".decode("latin-1")
17+
will return u"���"). This enables codec writer to create codecs
18+
for various simple to use conversions.
19+
20+
New codecs were added to demonstrate these new features (the .encode()
21+
and .decode() columns indicate the type of the returned objects):
22+
23+
Name | .encode() | .decode() | Description
24+
----------------------------------------------------------------------
25+
uu | string | string | UU codec (e.g. for email)
26+
base64 | string | string | base64 codec
27+
zlib | string | string | zlib compression
28+
hex | string | string | 2-byte hex codec
29+
rot-13 | string | Unicode | ROT-13 Unicode charmap codec
30+
631
- Some operating systems now support the concept of a default Unicode
732
encoding for file system operations. Notably, Windows supports 'mbcs'
833
as the default. The Macintosh will also adopt this concept in the medium

0 commit comments

Comments
 (0)