Skip to main content

"Simple is better than complex", Tim Peters, The Zen Of Python

Project description


**Tired of Python's `UnicodeDeocodeError, ascii codec can't decode?`**

Here's how to fix it, once and for all.

1. `$ pip install utf8forgood`
2. in your main program, add

import utf8forgood
If you like it, make the change permanent in your

# /path/to/site-packages/
import utf8forgood

To find the path to ``, run `python -m site` or read up on
the [site-specific configuration hook][8].


In general to the above, the fastest remedy is probably trying out the following, in this order:

1. Use `PYTONIOENCODING=UTF-8 python /path/to/`
2. Use the [`sys.setdefaultencoding`][1] hack. That is, unless you care [what others say][2]
3. Write your own import function to [convert data][3] appropriately, which is generally the [recommended way][4].

After [much consideration][7] and trying option 3 I finally concluded that option 2
is the straight forward way and usually [just does what you want][5], on the off-chance of [getting yourself in trouble][6].


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for utf8forgood, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size utf8forgood-0.1.4.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page