ftfy, The Wonky Text Fixing Python Library

Every Python programmer has undoubtedly come across some crazy characters. The ftfy library “Fixes Text For You” and acts like a swiss army knife when you’ve got questionable characters breaking your script. In my case, an HTTP request was failing because of weird cryptic letters hiding in the data when it was only supposed to be an apostrophe. This library fixed my text and made it appear flawless. I really like ftfy because it solves a common problem, fixing “mojibake” or mangled characters. It’s a good tool to have when you see these types of issues!

Install with pip:

pip install ftfy
source: ftfy documentation

See also: Python Unicode How To