About
Tool No. 39 of Pikkola
A string leaves one program and arrives at another, and each program has its own way of writing the characters that would otherwise confuse it. Escaping is that rewriting. This page does it in six dialects, in both directions, and shows the bytes so the result can be checked instead of trusted.
What it does
- URL: percent-encoding as encodeURIComponent, as encodeURI, or as application/x-www-form-urlencoded, with the three results side by side, and decoding back to text with a strict UTF-8 step.
- HTML: named, decimal and hexadecimal entities, with an option to write every character above ASCII as a number; decoding reads the 200 names a page is likely to meet plus numeric references.
- JSON and JavaScript: a string body or a quoted literal, control characters as \uXXXX, and characters above ASCII kept, written as a surrogate pair, or written as \u{...}.
- Shell: one POSIX argument in single quotes, where a single quote inside becomes '\''.
- CSV: one field, quoted when it holds the delimiter, a quote, a line break or padding, with comma, semicolon and tab.
- XML: the five predefined names, numeric references, and a warning for control characters that XML 1.0 cannot carry at all.
- Inspector: for every character, the code point, the UTF-16 code units, the UTF-8 bytes, the HTML reference and the JavaScript escape, plus the counts for the whole text.
Why the encoder is a decision, not a detail
encodeURIComponent encodes everything except the unreserved characters, so a value that sits after ?q= survives intact. encodeURI keeps the punctuation that gives an address its structure, which makes it right for a whole address and wrong for one value. The form encoding writes a space as a plus sign and leaves only a few characters bare, because that is what a server parsing application/x-www-form-urlencoded expects. A plus sign read as a space, or a slash read as a path separator, is how one wrong choice becomes a bug that takes an afternoon.
Why the bytes are shown
Mojibake is a byte problem, not a letter problem. When 가 arrives as ê°€, the UTF-8 bytes EA B0 80 have been read as three single-byte characters. The inspector puts the code point, the UTF-16 units and the UTF-8 bytes next to each character, so a string can be traced back to the byte that went wrong, and a decode that produced U+FFFD says how many sequences failed.
What it deliberately does not do
- It does not decide what a server will accept. It shows what each standard writes; the receiving end may be older or stricter.
- It does not decode Base64, decrypt a token, or parse a URL into its parts. Those are other tools, and one of them is linked at the foot of the page.
- It does not send, fetch, or store the text. There is no request of any kind after the page loads.
- It does not guarantee that an escaped string is safe to paste into SQL, a template or a log line. Escaping for a context is not the same as escaping for a language.
- No account, no upload, no analytics, no cookies, no fonts or scripts from another server.
Why it is free
Pikkola builds small tools that do one job and keeps them free, with no account and no advertising. A static page that computes in the browser costs almost nothing to serve, so there is no reason to charge for it.
Contact
A string that escapes wrongly, a phrase that reads badly in Korean or Japanese, a format that should be here and is not: hello@pikkola.com. Send the input and what you expected to see.
소개
피콜라 39번째 도구
문자열은 한 프로그램을 떠나 다른 프로그램에 도착하고, 각 프로그램은 자기를 헷갈리게 하는 글자를 저마다 다르게 적습니다. 이스케이프는 그 다시 쓰기입니다. 이 페이지는 여섯 가지 표기로 양방향 변환을 하고, 결과를 믿는 대신 확인할 수 있도록 바이트까지 보여 줍니다.
하는 일
- URL: encodeURIComponent, encodeURI, application/x-www-form-urlencoded 세 가지 퍼센트 인코딩과, 엄격한 UTF-8 검사를 거치는 디코딩. 세 결과를 나란히 보여 줍니다.
- HTML: 이름, 10진수, 16진수 엔티티. ASCII 바깥 글자를 모두 숫자로 적는 선택지도 있습니다. 디코딩은 흔히 만나는 200여 개의 이름과 숫자 참조를 읽습니다.
- JSON과 자바스크립트: 문자열 본문 또는 따옴표로 감싼 리터럴. 제어 문자는 \uXXXX로, ASCII 바깥 글자는 그대로 두거나 서로게이트 쌍으로, 또는 \u{...}로 적습니다.
- 셸: POSIX 인자 하나를 작은따옴표로 감싸고, 안의 작은따옴표는 '\''로 적습니다.
- CSV: 셀 하나. 구분자나 따옴표, 줄바꿈, 앞뒤 공백이 있으면 따옴표로 감쌉니다. 쉼표와 세미콜론, 탭을 지원합니다.
- XML: 미리 정해진 다섯 이름과 숫자 참조. XML 1.0이 아예 담을 수 없는 제어 문자는 따로 알려 줍니다.
- 검사기: 글자마다 코드포인트, UTF-16 코드 단위, UTF-8 바이트, HTML 참조, 자바스크립트 이스케이프와 전체 텍스트의 수치를 보여 줍니다.
인코더는 세부가 아니라 선택
encodeURIComponent는 예약되지 않은 글자만 남기고 모두 바꿉니다. ?q= 뒤에 놓이는 값이 온전히 살아남는 이유입니다. encodeURI는 주소의 구조를 만드는 문장부호를 남기므로 주소 전체에는 맞고 값 하나에는 틀립니다. 폼 인코딩은 공백을 더하기 기호로 쓰고 몇 글자만 그대로 둡니다. application/x-www-form-urlencoded를 해석하는 서버가 기대하는 모양입니다. 더하기 기호가 공백으로 읽히거나 슬래시가 경로 구분자로 읽히는 순간, 잘못 고른 하나가 오후 한 나절을 잡아먹는 버그가 됩니다.
바이트를 보여 주는 이유
문자 깨짐은 글자 문제가 아니라 바이트 문제입니다. 가가 ê°€로 도착했다면 UTF-8 바이트 EA B0 80을 1바이트 문자 셋으로 읽은 것입니다. 검사기는 글자마다 코드포인트와 UTF-16 단위, UTF-8 바이트를 나란히 놓아 어느 바이트에서 끊겼는지 따라갈 수 있게 하고, U+FFFD가 나온 디코딩은 몇 군데가 실패했는지 함께 말합니다.
일부러 하지 않는 일
- 서버가 무엇을 받아 줄지는 정하지 않습니다. 표준이 적는 값을 보여 줄 뿐이고, 받는 쪽은 더 엄격하거나 더 오래되었을 수 있습니다.
- Base64를 풀거나 토큰을 복호화하거나 URL을 구성 요소로 나누지 않습니다. 그 일은 다른 도구의 몫이고, 페이지 아래에 하나를 링크해 두었습니다.
- 텍스트를 보내지도, 받아 오지도, 저장하지도 않습니다. 페이지가 열린 뒤에는 어떤 요청도 나가지 않습니다.
- 이스케이프한 문자열이 SQL이나 템플릿, 로그에 넣어도 안전하다고 보증하지 않습니다. 문맥을 위한 이스케이프와 언어를 위한 이스케이프는 다릅니다.
- 계정도, 업로드도, 분석도, 쿠키도, 다른 서버의 글꼴이나 스크립트도 없습니다.
무료인 이유
피콜라는 한 가지 일을 하는 작은 도구를 만들고 계정도 광고도 없이 무료로 유지합니다. 브라우저에서 계산하는 정적 페이지는 서빙 비용이 거의 들지 않으니 값을 매길 이유가 없습니다.
연락
이스케이프가 틀린 문자열, 한국어나 일본어에서 어색한 문장, 여기 있어야 할 것 같은데 없는 형식은 hello@pikkola.com으로 보내 주세요. 넣은 값과 기대한 결과를 함께 적어 주시면 확인이 빠릅니다.
概要
Pikkola 39 番目の道具
文字列は一つのプログラムを離れて別のプログラムに届き、それぞれが自分を困らせる文字を独自の書き方に変えます。エスケープはその書き換えです。このページは六つの書き方で両方向に変換し、結果を信じるのではなく確かめられるようバイトまで示します。
すること
- URL: encodeURIComponent、encodeURI、application/x-www-form-urlencoded の三つのパーセント符号化と、厳密な UTF-8 検査を通す復号。三つの結果を並べます。
- HTML: 名前、10 進、16 進の実体参照。ASCII 以外の文字もすべて番号で書く選択肢があります。復号はよく出会う 200 ほどの名前と数値参照を読みます。
- JSON と JavaScript: 文字列の中身、または引用符で囲んだリテラル。制御文字は \uXXXX、ASCII 以外はそのまま、サロゲートペア、\u{...} のいずれか。
- シェル: POSIX の引数一つを単一引用符で囲み、中の単一引用符は '\'' と書きます。
- CSV: セル一つ。区切り、引用符、改行、前後の空白があれば引用符で囲みます。カンマ、セミコロン、タブに対応します。
- XML: 決められた五つの名前と数値参照。XML 1.0 が参照でも運べない制御文字は別に知らせます。
- 検査: 文字ごとにコードポイント、UTF-16 コード単位、UTF-8 バイト、HTML の参照、JavaScript のエスケープと、全体の数値を示します。
エンコーダは細部ではなく選択
encodeURIComponent は予約されていない文字だけを残し、ほかをすべて置き換えます。?q= のあとに置く値がそのまま残るのはこのためです。encodeURI はアドレスの構造を作る記号を残すので、アドレス全体には正しく、値一つには誤りです。フォーム符号化は空白を + にし、ごく少数の文字だけを残します。application/x-www-form-urlencoded を読むサーバが期待する形です。+ が空白として読まれ、スラッシュが経路の区切りとして読まれた瞬間、選択一つが午後を奪う不具合になります。
バイトを示す理由
文字化けは文字の問題ではなくバイトの問題です。가 が ê°€ として届いたなら、UTF-8 のバイト EA B0 80 を 1 バイト文字の三つとして読んだということです。検査は文字ごとにコードポイント、UTF-16 単位、UTF-8 バイトを並べ、どのバイトで切れたかをたどれるようにします。U+FFFD が出た復号は、何か所が失敗したかも伝えます。
意図してやらないこと
- サーバが何を受け取るかは決めません。標準が書く値を示すだけで、受け取る側はもっと厳しいか、もっと古いかもしれません。
- Base64 を解いたり、トークンを復号したり、URL を部品に分けたりはしません。それは別の道具の仕事で、ページの下に一つを載せています。
- テキストを送らず、取りに行かず、保存しません。ページが開いたあとはいかなる要求も出ません。
- エスケープした文字列が SQL やテンプレート、ログに安全に貼れるとは保証しません。文脈のためのエスケープと言語のためのエスケープは別です。
- アカウントも、アップロードも、分析も、クッキーも、別のサーバのフォントやスクリプトもありません。
無料の理由
Pikkola は一つの仕事をする小さな道具を作り、アカウントも広告もなく無料で保ちます。ブラウザで計算する静的なページは配信の費用がほとんどかからないので、値段を付ける理由がありません。
連絡
エスケープが違う文字列、韓国語や日本語で読みにくい文、ここにあるべきなのに無い形式は hello@pikkola.com まで。入れた値と期待した結果を添えてください。