YorozuyaIT
Japanese Text & Encoding

ä Instead of ä? Fixing Garbled Umlauts, é, ß, and € in Websites, CSVs, and Databases

Written by the Yorozuya IT editorial team, based in Japan. Menus, apps, and rules change, so check the date.

Short answer

You open a customer list and see Müller instead of Müller. A web page shows Größe instead of Größe. A price reads 30 €. These are classic mojibake: the bytes are right, but the program is reading them with the wrong encoding.

The decoder

A grid of garbled sequences and the characters they stand for: ä is ä, ö is ö, ü is ü, ß is ß, € is €

UTF-8 writes each non-ASCII letter as two or three bytes. If a program assumes Windows-1252 or Latin-1 instead, it shows each byte as its own character. The first byte of most European accented letters (C3, C5) becomes à or Å, and the euro sign (E2 82 AC) becomes €.

Should be You see
ä ö ü ß Ã¤ ö ü ß
é è ç ñ é è ç ñ
å ø Ã¥ ø
€ ’ € ’
ł ą Å‚ Ä…

Where to look first

  1. Web pages: Declare <meta charset="utf-8"> early in the <head>, and send Content-Type: text/html; charset=utf-8 from the server.
  2. CSV and text files: Save as UTF-8. For files opened in Excel, add a BOM (utf-8-sig). See the Excel CSV guide.
  3. Databases: Use utf8mb4 in MySQL and MariaDB for columns and for the connection (SET NAMES utf8mb4, or set it in your driver).
  4. Email: Check the Content-Type charset header of the message.
  5. APIs and scripts: Be explicit about encodings when reading and writing, instead of relying on defaults.

Repairing text that is already damaged

If the damage came from exactly one wrong decode, you can reverse it. In Python:

bad = "Größe: 30 €"
good = bad.encode("cp1252").decode("utf-8")
print(good)   # Größe: 30 €

This works for simple cases. Real data often fails, for example when a character maps to a byte that Windows-1252 leaves undefined (such as the right double quote in �), the conversion raises an error, or the text was damaged more than once. The ftfy library is built for this:

import ftfy
print(ftfy.fix_text("Größe: 30 €"))

Always keep a copy of the original and check the result by reading it.

The opposite problem: � symbols

If a Latin-1 or Windows-1252 file is read as UTF-8, you see replacement characters (�) where the accents should be. Read the file with the right legacy encoding and save it as UTF-8:

text = open("legacy.txt", encoding="cp1252").read()
open("utf8.txt", "w", encoding="utf-8").write(text)

Central and Eastern Europe

Languages like Polish, Czech, and Hungarian have been written with Windows-1250 or ISO-8859-2, which differ for some letters. If characters like ł, ő, or ű are wrong, you may have the wrong one of the two. Converting everything to UTF-8 at the boundary ends the guessing.

Quick checklist

For the same idea in Japanese, where the garbage looks different, see garbled Japanese in Excel.

FAQ

What if I see � instead?

The replacement character usually means the opposite problem: a Latin-1 or Windows-1252 file was read as UTF-8. Read it with the right legacy encoding, then save as UTF-8.

Why did my text get worse every time I saved?

Repeated wrong conversions can double-encode text (for example ’). Stop saving, find the first wrong step, and repair from the original if you have it.

My Polish or Czech letters are wrong in a different way.

Windows-1250 and ISO-8859-2 are both used for Central European languages and differ for a few letters. UTF-8 avoids the choice, so convert to it and declare it.

Keep reading