- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | steven.daprano |
|---|---|
| Recipients | ezio.melotti, lemburg, radiocane, serhiy.storchaka, steven.daprano, vstinner |
| Date | 2018-12-20.10:18:44 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1545301124.81.0.788709270274.issue35544@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
|---|
Encoding and decoding, in the most general sense, can include unicode -> unicode and bytestring -> bytestring. I can't see any standard unicode->unicode encodings in Python 2.7 https://docs.python.org/2/library/codecs.html but we can create one: py> import codecs py> class NullCodec(codecs.Codec): # "do nothing" codec ... def encode(self, input, errors='strict'): ... return (input, len(input)) ... def decode(self, input, errors='strict'): ... return (input, len(input)) ... py> def getregentry(name): ... return codecs.CodecInfo( ... name='null', ... encode=NullCodec().encode, ... decode=NullCodec().decode, ... incrementalencoder=None, ... incrementaldecoder=None, ... streamwriter=None, ... streamreader=None, ... ) ... py> codecs.register(getregentry) py> u'unicode text'.encode('null') u'unicode text' so the documentation is correct, and the Stackoverflow answer is not. |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-12-20 10:18:44 | steven.daprano | set | recipients: + steven.daprano, lemburg, vstinner, ezio.melotti, serhiy.storchaka, radiocane |
| 2018-12-20 10:18:44 | steven.daprano | set | messageid: <1545301124.81.0.788709270274.issue35544@psf.upfronthosting.co.za> |
| 2018-12-20 10:18:44 | steven.daprano | link | issue35544 messages |
| 2018-12-20 10:18:44 | steven.daprano | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
