PEP 293 implemention (from SF patch http://www.python.org/sf/432401)

This commit is contained in:
Walter Dörwald 2002-09-02 13:14:32 +00:00
parent 94fab762de
commit 3aeb632c31
12 changed files with 2936 additions and 563 deletions

View file

@ -20,7 +20,10 @@ except ImportError, why:
__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE",
"BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE",
"BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE",
"BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE"]
"BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE",
"strict_errors", "ignore_errors", "replace_errors",
"xmlcharrefreplace_errors",
"register_error", "lookup_error"]
### Constants
@ -632,6 +635,14 @@ def make_encoding_map(decoding_map):
m[v] = None
return m
### error handlers
strict_errors = lookup_error("strict")
ignore_errors = lookup_error("ignore")
replace_errors = lookup_error("replace")
xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace")
backslashreplace_errors = lookup_error("backslashreplace")
# Tell modulefinder that using codecs probably needs the encodings
# package
_false = 0