objstr: Add str.encode() and bytes.decode() methods.

These largely duplicate str() & bytes() constructors' functionality,
but can be used to achieve Python2 compatibility.
This commit is contained in:
Paul Sokolovsky
2014-04-13 05:28:46 +03:00
parent fe6ded4d17
commit 73b7027b83
3 changed files with 43 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ if platform.python_version_tuple()[0] == '2':
from htmlentitydefs import codepoint2name
elif platform.python_version_tuple()[0] == '3':
from html.entities import codepoint2name
codepoint2name[ord('-')] = 'hyphen';
# add some custom names to map characters that aren't in HTML
codepoint2name[ord('.')] = 'dot'