Serhiy Storchaka
c7797dc748
Issue #19543 : Emit deprecation warning for known non-text encodings.
...
Backported issues #19619 : encode() and decode() methods and constructors
of str, unicode and bytearray classes now emit deprecation warning for known
non-text encodings when Python is ran with the -3 option.
Backported issues #20404 : io.TextIOWrapper (and hence io.open()) now uses the
internal codec marking system added to emit deprecation warning for known non-text
encodings at stream construction time when Python is ran with the -3 option.
2015-05-31 20:21:00 +03:00
Serhiy Storchaka
5312a7f912
Avoid deprecation warnings.
2015-01-31 11:27:06 +02:00
Serhiy Storchaka
e0ed2d75c8
Issue #19936 : Added executable bits or shebang lines to Python scripts which
...
requires them. Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.
2014-01-16 18:59:17 +02:00
Victor Stinner
73363e817a
Issue #6213 : Implement getstate() and setstate() methods of utf-8-sig and
...
utf-16 incremental encoders.
2010-07-28 01:39:45 +00:00
Georg Brandl
f0757a2937
#8016 : add the CP858 codec (approved by Benjamin). (Also add CP720 to the tests, it was missing there.)
2010-05-24 21:29:07 +00:00
Victor Stinner
54b40ee929
Fix my last commit (r81471) about codecs
...
Rememder: don't touch the code just before a commit
2010-05-22 13:44:25 +00:00
Victor Stinner
7df55dad3b
Issue #6268 : More bugfixes about BOM, UTF-16 and UTF-32
...
* Fix seek() method of codecs.open(), don't write the BOM twice after seek(0)
* Fix reset() method of codecs, UTF-16, UTF-32 and StreamWriter classes
* test_codecs: use "w+" mode instead of "wt+". "t" mode is not supported by
Solaris or Windows, but does it really exist? I found it the in the issue.
2010-05-22 13:37:56 +00:00
Benjamin Peterson
f4803aa623
set svn:eol-style on various files
2010-03-08 22:15:11 +00:00
Philip Jenvey
fab8be2f99
#1757126 : fix typo with the cyrillic_asian alias
2009-11-17 02:42:26 +00:00
Benjamin Peterson
6e3dbbdf39
replace has_key with 'in' operator
2009-10-09 22:15:50 +00:00
Benjamin Peterson
de0559998f
replace callable()
2009-10-09 22:05:45 +00:00
Amaury Forgeot d'Arc
70dda76cde
#1616979 : Add the cp720 (Arabic DOS) encoding.
...
Since there is no official mapping file from unicode.org,
the codec file is generated on Windows with the new genwincodec.py script.
2009-07-13 20:01:11 +00:00
Christian Heimes
082c9b0267
Fixed bug #1915 : Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support.
2008-01-23 14:20:50 +00:00
Amaury Forgeot d'Arc
5087980c1e
The incremental decoder for utf-7 must preserve its state between calls.
...
Solves issue1460.
Might not be a backport candidate: a new API function was added,
and some code may rely on details in utf-7.py.
2007-11-20 23:31:27 +00:00
Walter Dörwald
183744d6b9
Fix for #1444 : utf_8_sig.StreamReader was (indirectly through decode())
...
calling codecs.utf_8_decode() with final==True, which falled with incomplete
byte sequences. Fix and test by James G. Sack.
2007-11-19 12:41:10 +00:00
Georg Brandl
4cdceac760
Fix #883466 : don't allow Unicode as arguments to quopri and uu codecs.
2007-09-03 07:16:46 +00:00
Walter Dörwald
6e39080649
Backport r57105 and r57145 from the py3k branch: UTF-32 codecs.
2007-08-17 16:41:28 +00:00
Walter Dörwald
4234827e99
Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
...
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
2007-04-12 10:35:00 +00:00
Brett Cannon
fa6521b4fd
Make the __import__ call in encodings.__init__ absolute with a level 0 call.
2007-02-16 19:33:01 +00:00
Brett Cannon
971a012ce1
Update the encoding package's search function to use absolute imports when
...
calling __import__. This helps make the expected search locations for encoding
modules be more explicit.
One could use an explicit value for __path__ when making the call to __import__
to force the exact location searched for encodings. This would give the most
strict search path possible if one is worried about malicious code being
imported. The unfortunate side-effect of that is that if __path__ was modified
on 'encodings' on purpose in a safe way it would not be picked up in future
__import__ calls.
2007-02-15 22:54:39 +00:00
Georg Brandl
4ba9e5bdc7
Patch #1634778 : add missing encoding aliases for iso8859_15 and
...
iso8859_16.
2007-01-27 17:59:42 +00:00
Walter Dörwald
39b8b6afb5
Change decode() so that it works with a buffer (i.e. unicode(..., 'utf-8-sig'))
...
SF bug #1601501 .
2006-11-23 05:03:56 +00:00
Georg Brandl
2c9838e30f
Bug #1586613 : fix zlib and bz2 codecs' incremental en/decoders.
2006-10-29 14:39:09 +00:00
Georg Brandl
a92979a1db
Bug #1446043 : correctly raise a LookupError if an encoding name given
...
to encodings.search_function() contains a dot.
2006-09-30 11:22:28 +00:00
Neal Norwitz
391e5f4c9f
importing types is not necessary if we use isinstance
2006-08-25 01:52:49 +00:00
Martin v. Löwis
961b91bd3c
Correction of patch #1455898 : In the mbcs decoder, set final=False
...
for stream decoder, but final=True for the decode function.
2006-08-02 13:53:55 +00:00
Martin v. Löwis
0eac11826a
Make import/lookup of mbcs fail on non-Windows systems.
2006-06-15 06:45:05 +00:00
Martin v. Löwis
d825143be1
Patch #1455898 : Incremental mode for "mbcs" codec.
2006-06-14 05:21:04 +00:00
Walter Dörwald
c6f5b3ad6c
errors is an attribute in the incremental decoder
...
not an argument.
2006-06-13 12:04:43 +00:00
Walter Dörwald
6b6e2bb8b1
Fix passing errors to the encoder and decoder functions.
2006-06-13 12:02:12 +00:00
Tim Peters
c7d14452a4
Whitespace normalization.
2006-06-04 23:43:53 +00:00
Martin v. Löwis
3f767795f6
Patch #1359618 : Speed-up charmap encoder.
2006-06-04 19:36:28 +00:00
Walter Dörwald
78a0be6ab3
Add a BufferedIncrementalEncoder class that can be used for implementing
...
an incremental encoder that must retain part of the data between calls
to the encode() method.
Fix the incremental encoder and decoder for the IDNA encoding.
This closes SF patch #1453235 .
2006-04-14 18:25:39 +00:00
Walter Dörwald
a40cf31de6
Make error message less misleading for u"a..b".encode("idna").
2006-04-14 17:00:36 +00:00
Walter Dörwald
6493699c0d
Make raise statements PEP 8 compatible.
2006-04-14 15:22:27 +00:00
Walter Dörwald
a8da934069
Whitespace.
2006-03-27 09:02:04 +00:00
Hye-Shik Chang
e2ac4abd01
Patch #1443155 : Add the incremental codecs support for CJK codecs.
...
(reviewed by Walter Dörwald)
2006-03-26 02:34:59 +00:00
Guido van Rossum
f8480a7856
Instead of relative imports, use (implicitly) absolute ones.
2006-03-15 23:08:13 +00:00
Tim Peters
f99b8162a2
Whitespace normalization.
2006-03-15 18:08:37 +00:00
Walter Dörwald
13ed60b504
Fix typo.
2006-03-15 13:36:50 +00:00
Walter Dörwald
abb02e5994
Patch #1436130 : codecs.lookup() now returns a CodecInfo object (a subclass
...
of tuple) that provides incremental decoders and encoders (a way to use
stateful codecs without the stream API). Functions
codecs.getincrementaldecoder() and codecs.getincrementalencoder() have
been added.
2006-03-15 11:35:15 +00:00
Guido van Rossum
87de069e4e
Use relative imports in a few places where I noticed the need.
...
(Ideally, all packages in Python 2.5 will use the relative import
syntax for all their relative import needs.)
2006-03-15 04:33:54 +00:00
Martin v. Löwis
5bd7c02298
Avoid forward-declaring the methods array.
...
Rename unicodedata.db* to unicodedata.ucd*
2006-03-10 11:20:04 +00:00
Martin v. Löwis
480f1bb67b
Update Unicode database to Unicode 4.1.
2006-03-09 23:38:20 +00:00
Marc-André Lemburg
fe4b34cc4b
Fix the encodings package codec search function to only search
...
inside its own package. Fixes problem reported in patch #1433198 .
Add codec search function for codec test codec.
2006-02-19 15:22:22 +00:00
Martin v. Löwis
412ed3b8a7
Patch #1177307 : UTF-8-Sig codec.
2006-01-08 10:45:39 +00:00
Tim Peters
536cf99536
Whitespace normalization.
2005-12-25 23:18:31 +00:00
Marc-André Lemburg
d9cf593b49
Cosmetic change: make all hex literals use upper case hex so that they
...
look more like the Unicode Consortium files.
Add ending new-line to all source files.
2005-10-24 12:14:59 +00:00
Marc-André Lemburg
3c72ded23d
Removed the decoding_map from the codecs where this is possible.
...
Replaced the tis_620, cp1140 and koi8_u codecs with new ones
based on custom mapping files.
2005-10-24 12:07:49 +00:00
Marc-André Lemburg
0f00ba8bd8
Replace the old EBCDIC codecs with new ones using the decoding table.
2005-10-21 14:35:35 +00:00