Free plan

Fix text encoding

Fix strange symbols in a text file, like broken accents
POST
/v1/documents/encoding

About this tool

Sometimes a text file shows odd symbols instead of accents, such as é instead of é. This happens when the file was saved in one text system and read in another. This tool finds the system used, repairs the garbled text, and saves the file in the one you choose, usually UTF-8, the most common. You can also change the line endings.
For example, a customer list shows é and ü where there should be accents, and you want a clean copy.

How to use it

  1. Choose this tool.
  2. Add your text file, such as a txt or csv file, with Upload or drag and drop.
  3. Keep Detect automatically for the current system, and choose the one you want to save in.
  4. Press Generate.
  5. Download the fixed file.

What you get back

You get a new text file with correct letters, saved in the system you chose. Your original file is not changed.
GOOD TO KNOW
Detection from the bytes is a best guess for legacy encodings: check the candidates, and give `from` when you know it. Counts as one document.
TEST IT LIVE

Try Fix text encoding in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Documents
Plan
Free
Method
POST
Endpoint
/v1/documents/encoding
Tool ID
documents.encoding
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Documents
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/documents/encoding" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'from=windows-1256' \
  -F 'newline=keep' \
  -F 'normalize=none'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.encoding({
    "file": 'document.pdf',
    "from": "windows-1256",
    "newline": "keep",
    "normalize": "none"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->encoding([
    'file' => 'document.pdf',
    'from' => 'windows-1256',
    'newline' => 'keep',
    'normalize' => 'none',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Detect the encoding of a text file, repair garbled text (UTF-8 read as Windows-1252, "é" for "é") and write it in the encoding you choose, with line endings, a byte order mark, normalisation and control characters under your control.

Fix text encoding works from text and settings, so no file is needed. Every input is optional.

Fix text encoding is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/documents/encoding with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.