How It WorksPublished 8 min read

How to Read %E3%81%82, \u3042, and \343: Why Japanese Turns into Codes in URLs, JSON, and Git

You copy a URL and get “%E6%96%87%E5%AD%97”. An API returns “\u6587\u5b57”. A Git filename shows up as “\346\226\207”. They all look like garbled text, but the Japanese isn’t broken: its bytes or code numbers have been written out in ASCII, and you’re seeing those codes as is. This article covers how to recognize and read nine common notations, where they appear, and settings that display Japanese instead.

Encoded text isn’t mojibake; it’s another way of writing Japanese

Mojibake is what you get when text is read as different characters because the encoding was mistaken. By contrast, %E3%81%82 and \u3042 are deliberate ASCII replacements, used to write Japanese where only ASCII is allowed. Once you know the notation, you can return to the Japanese without losing a single character.

Broadly, there are two approaches: writing a character’s number (its Unicode code point), or writing its bytes (the numbers it’s stored as in UTF-8 or another encoding). The hiragana “a” has the Unicode number U+3042 (12354 in decimal) and the UTF-8 bytes E3 81 82. Remember these two numbers and you can quickly tell which notation you’re looking at.

Chart of nine notations

NotationExample (文字, “characters”, etc.)What it encodesWhere it often appears
URL encoding%E6%96%87%E5%AD%97UTF-8 bytesURLs, search terms, downloaded filenames
URL encoding (older form)%95%B6%8E%9AShift_JIS bytesURLs of older Japanese sites and bulletin boards
Unicode escape\u6587\u5b57Unicode numbers (hex)JSON, JavaScript, API responses
Octal escape\346\226\207\345\255\227UTF-8 bytes (octal)Filenames in git status and git diff
Byte escape\xe6\x96\x87\xe5\xad\x97UTF-8 bytes (hex)Python bytes, logs, error messages
HTML character reference文字 / 文字Unicode numbers (decimal or hex)HTML source, RSS, HTML email
Quoted-Printable=E6=96=87=E5=AD=97UTF-8 bytesSource of email bodies
Punycodexn--wgv71a119e.jpA converted Japanese domain nameURLs with Japanese domains (日本語.jp)
Base645paH5a2X5YyW44GRUTF-8 bytes written with 64 kinds of charactersEmail attachments and bodies, API data

We checked these examples by entering them into “Read escapes” in the Mojibake Fixer & Decoder. The Base64 example decodes to the Japanese word for “mojibake”, and the others to 文字 (Punycode to 日本語.jp). If text mixes several notations, the tool finds and reads each one.

%E3%81%82 in URLs: what you get when copying a Japanese URL

URLs allow only ASCII letters, digits, and some symbols, so Japanese is written as UTF-8 bytes, each as “%” plus two hex digits. A Japanese character is 3 bytes in UTF-8, so three %XX make one character. The 4-character Japanese word for “mojibake” becomes “%E6%96%87%E5%AD%97%E5%8C%96%E3%81%91”, which is 36 characters.

  • Even if the browser’s address bar shows Japanese, copying and pasting into a chat or email gives the %XX form
  • Sequences starting with %E3 are usually hiragana or katakana, and those starting with %E4–%E9 are usually kanji
  • If you see many %82 or %83 and two %XX seem to make one character, it may be an old URL written in Shift_JIS
  • “+” can represent a space (in URLs submitted from search forms, for example)

When sending a URL to someone, the %XX form is the safer choice. A URL turned back into Japanese can have its link cut off partway in some apps.

\u3042 in JSON, \343 in Git, \xe3 in Python

In programming, Japanese is often written in escaped form instead of being output directly. Each case below has a setting or method for displaying Japanese.

  • \u3042 in JSON: a Unicode number written in 4 hex digits. For JSON output in Python, adding ensure_ascii=False keeps the Japanese as is. Emoji are written as a pair, as in “🍣” (🍣)
  • \343\201\202 in Git: a Japanese filename shown in octal by git status and similar commands. Setting git config --global core.quotepath false displays it in Japanese
  • \xe3\x81\x82 in Python: a bytes object displayed as is. Convert it to a string with .decode('utf-8') and you get Japanese
  • あ and あ in HTML: a Unicode number written in decimal or hex. Browsers show the hiragana “a”, but in source or RSS viewed as text you see the code

Domains starting with xn-- are internationalized domains

Japanese domains like 日本語.jp are converted to ASCII because of how DNS works. The conversion method is Punycode, and converted names carry the prefix “xn--”. “xn--wgv71a119e.jp” is 日本語.jp.

To prevent impersonation using lookalike characters, browsers sometimes deliberately display Japanese domains in the xn-- form. For email or links from an unfamiliar xn-- domain, it’s safest to convert it back and confirm that it really is the domain you expect.

If real mojibake like “縺” or “ã” is mixed in rather than codes, check the pattern in the Mojibake Patterns Chart. The =?UTF-8?B?…?= in email subjects belongs to the same family, and it’s explained in Garbled Email Subjects.

FAQ

How do I turn %E3%81%82 in a URL back into Japanese?
Collect the two hex digits after each % as one byte and read them as UTF-8. %E3%81%82 is the hiragana “a”. In Japanese, three %XX make one character. Paste it into “Read escapes” in the Mojibake Fixer & Decoder to convert everything at once.
What is \u3042 in JSON?
It’s a Unicode escape, a Unicode number written in 4 hex digits; \u3042 is the hiragana “a”. JSON output is often configured to write Japanese this way. Emoji use a pair to represent one character, as in 🍣.
Git shows Japanese filenames like \343\201\202. Why?
Git is displaying the UTF-8 bytes of the Japanese filename in octal. Set git config --global core.quotepath false, and git status and similar commands will display them in Japanese.
Are URLs starting with xn-- dangerous?
xn-- simply marks an internationalized domain, such as a Japanese one, converted to ASCII. It isn’t dangerous by itself. But it’s also used for impersonation with lookalike characters, so converting it back and checking the domain name is the safe move.

Tools in this article

Related articles

How It Works8 min read

Mojibake Patterns Chart: Identify the Encoding Mix-Up from 縺, ã, ‚, ƒ, and $B

Garbled Japanese like “縺薙s縺ォ縺。縺ッ”, “日本語”, or “‚±‚ñ‚É‚¿‚Í” looks random, but it follows strict rules. The first few characters usually tell you which encoding was mistaken for which. This article lays out the seven most common patterns in a chart with examples, explains why each happens, and shows which ones can be reversed.

Read article →
How It Works8 min read

Garbled Email Subjects: Causes and Fixes, and How to Read =?UTF-8?B?, =?ISO-2022-JP?B?, and $B

A Japanese email may arrive with a subject like “=?UTF-8?B?5paH5a2X…?=”, or a body that reads “$BL@F|$N…(B”. What you’re seeing is the standard way of sending Japanese by email, left undecoded. This article explains how =?…?= subjects work, the difference between the B and Q methods, the $B in JIS mail, why email bodies get garbled, and what senders can do about it.

Read article →
How-to Guide8 min read

CSV Garbled in Excel? How to Fix It: UTF-8 With BOM vs Other Encodings

You downloaded a CSV from a web service, double-clicked it, and Excel showed “Café, München” instead of “Café, München”. The CSV isn't broken: Excel simply guessed the wrong character encoding. This guide explains why it happens, how to open the CSV you have now so it reads correctly, how to save so it never happens again (UTF-8 with BOM, or a legacy encoding), and which characters are lost when you convert.

Read article →