python-ftfy: Effortlessly Fixing Mojibake and Unicode Glitches

This repository profile is provided by osrepos.com, an open source repository discovery platform.

python-ftfy: Effortlessly Fixing Mojibake and Unicode Glitches

Summary

ftfy is a powerful Python library designed to automatically correct "mojibake" and other common glitches in Unicode text. It intelligently detects and fixes encoding mix-ups, transforming unreadable characters into their intended form. This tool is essential for developers and data scientists working with messy text data, ensuring readability and data integrity.

Repository Information

Analyzed by OSRepos on October 21, 2025

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

ftfy, short for "fixes text for you", is a robust Python library developed by Robyn Speer, designed to effortlessly correct "mojibake" and other common glitches in Unicode text. It intelligently detects patterns of characters that were clearly meant to be UTF-8 but were decoded incorrectly, transforming unreadable text into its intended, comprehensible form. This tool is invaluable for anyone working with diverse and potentially corrupted text data.

Installation

Getting started with ftfy is straightforward. It is a Python 3 package and can be installed using pip:

pip install ftfy

If you have both Python 2 and 3 installed, you might need to use pip3:

pip3 install ftfy

Examples

ftfy excels at fixing a variety of text corruption issues. Here are some real-world examples of its capabilities:

Fixing basic mojibake (encoding mix-ups):

import ftfy
print(ftfy.fix_text('✔ No problems'))
# Expected output: '? No problems'

Correcting multiple layers of mojibake simultaneously:

import ftfy
print(ftfy.fix_text('The Mona Lisa doesn’t have eyebrows.'))
# Expected output: "The Mona Lisa doesn't have eyebrows."

Handling mojibake with "curly quotes" applied on top:

import ftfy
print(ftfy.fix_text("l’humanité"))
# Expected output: "l'humanité"

Decoding HTML entities outside of HTML, even with incorrect capitalization:

import ftfy
print(ftfy.fix_text('PÉREZ'))
# Expected output: 'PÉREZ'

A key principle of ftfy is to avoid false positives. It will not alter text that is already sensible, ensuring data integrity:

import ftfy
print(ftfy.fix_text('IL Y MARQUÉ…'))
# Expected output: 'IL Y MARQUÉ…' (unchanged)

Why Use ftfy?

Dealing with corrupted or improperly encoded text data can be a significant challenge, consuming valuable development time and leading to frustrating debugging sessions. ftfy automates the complex process of identifying and correcting these errors, making it a "handy piece of magic" as described by users. Its ability to recover original strings from seemingly impossible mojibake patterns is a testament to its robust design.

ftfy has been widely adopted and cited in major Natural Language Processing (NLP) research, proving its reliability and effectiveness in crucial data processing steps. Testimonials highlight its ability to save "a large amount of frustrating dev work" and make life "livable again" for developers.

Further Resources

To learn more about ftfy and its extensive capabilities, explore the following resources:

Related repositories

Similar repositories that may be relevant next.

dify-official-plugins: Extending Dify with AI Models, Tools, and Agent Strategies

dify-official-plugins: Extending Dify with AI Models, Tools, and Agent Strategies

August 18, 2026

The `dify-official-plugins` repository hosts a collection of official plugins for Dify, an open-source platform for developing LLM-powered AI applications. These plugins, including models, tools, agent strategies, and extensions, enhance Dify's capabilities and are maintained by the official Dify team. They are designed to help developers efficiently build, deploy, and manage AI-driven solutions.

PythonAILLM
Agent Skills: A Standardized Way to Give AI Agents New Capabilities

Agent Skills: A Standardized Way to Give AI Agents New Capabilities

August 18, 2026

Agent Skills provides a lightweight, open format for extending AI agent capabilities with specialized knowledge and workflows. It allows packaging procedural knowledge and context into portable, version-controlled folders that agents load on demand. This enables agents to gain domain expertise, follow repeatable workflows, and reuse skills across various compatible AI tools.

agent-skillsPythonAI
A-MEM: Self-Evolving Memory for Coding Agents

A-MEM: Self-Evolving Memory for Coding Agents

August 17, 2026

A-MEM is an innovative self-evolving memory system designed for coding agents, organizing knowledge into a dynamic Zettelkasten-style graph. It allows memories to evolve and connect over time, enhancing an agent's ability to recall and utilize information effectively. This system offers both semantic and structural search capabilities for a richer knowledge base.

PythonAILLM
Agent Sandbox: Secure Local Development for AI Coding Agents

Agent Sandbox: Secure Local Development for AI Coding Agents

August 17, 2026

Agent Sandbox provides a robust and secure local development environment specifically designed for collaborating with AI coding agents. It ensures minimal filesystem access, configurable network egress policies, and secure secret injection, protecting your local machine from potentially risky agent operations. This project supports various AI agents and integrates seamlessly with both CLI and popular IDE devcontainer setups.

agent-harnessagent-sandboxagents

Source repository

Open the original repository on GitHub.

7 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️