Nhân vật Trung Quốc để Unicode, GBK và GB18030 Code Converter

Paste characters to see their Unicode, UTF-8 and GBK codes in a table, copy \u escapes or HTML entities, and preview the mojibake when UTF-8 is read as GBK.

Chạy trong trình duyệt của bạn. Tệp không bao giờ rời khỏi thiết bị. Xem cách tự kiểm tra

…

Cách thực hiện

  1. 1
    Ghi dấu

    Nhập hoặc dán văn bản tiếng Trung.

  2. 2
    Đọc bảng.

    Xem mã điểm, byte UTF-8 và mã GBK của mỗi ký tự.

  3. 3
    Phá bỏ bản sao

    Copy \u escapes or HTML entities.

  4. 4
    Kiểm tra mojibake

    So sánh bản xem trước với văn bản bị biến dạng mà bạn có.

Giới thiệu công cụ này

Chinese text is stored in computers with different encodings. Unicode gives every character a code point, such as U+4E2D for 中, and UTF-8, the encoding of the web, stores most Chinese characters in three bytes. Older Chinese systems, Windows programs, many government and banking files and CSV exports from Excel in Chinese locales still use GBK, which stores Chinese characters in two bytes and is a subset of the national standard GB 18030, mandatory for software sold in China. When a file is read with the wrong encoding, Chinese turns into garbage known as mojibake: UTF-8 bytes read as GBK produce strings such as 涓枃. This converter shows, for each character, the code point, the UTF-8 bytes and the GBK code, generates \u escapes for code and HTML numeric entities, and previews what your text looks like when its UTF-8 bytes are misread as GBK, so you can recognise and diagnose the problem.

Who this is for

Developers handling Chinese text in files and databases, data analysts opening CSV files, translators and localisation engineers, and anyone puzzled by garbled Chinese.

Unicode and UTF-8

Unicode assigns a number to each character. UTF-8 writes code points from U+0800 to U+FFFF, which covers common Chinese characters, as three bytes; rare characters in the extension blocks beyond U+FFFF use four bytes.

GBK and GB18030

GBK covers about 21,000 Chinese characters and symbols in two-byte codes. GB 18030 extends it to cover all of Unicode with one-, two- and four-byte codes; since 2023 the 2022 edition of the standard applies to software sold in China. The tool looks up two-byte GBK codes using the browser's encoding support. Characters outside GBK, such as the euro sign in some tables or rare characters, show a dash.

Mojibake

When UTF-8 Chinese is read as GBK, every three bytes are split into odd pairs and produce wrong characters; the preview shows the result. The reverse problem, GBK files opened as UTF-8, usually shows replacement characters. Recognising the pattern tells you which encoding to choose when reopening the file.

Escapes and entities

\u escapes are used in JavaScript, JSON and Java strings. HTML numeric entities such as 中 display characters in web pages regardless of the page encoding.

Fixing files

To fix a CSV that shows mojibake in Excel, open it with the data import function and choose the correct encoding, or save it as UTF-8 with a byte order mark. In code, read files with the encoding they were written in, then convert.

Worked example

For 中文汉字, the table shows U+4E2D, U+6587, U+6C49 and U+5B57, UTF-8 bytes such as E4 B8 AD and GBK codes D6D0, CEC4, BABA and D7D6. Misread as GBK, the UTF-8 bytes appear as 涓枃姹夊瓧.

Limits

A lookup and diagnosis aid, not official advice. The browser's encoding support decides GBK codes.

Ví dụ có lời giải

中 = U+4E2D, UTF-8 E4 B8 AD, GBK D6D0; 中文汉字 in UTF-8 read as GBK shows 涓枃姹夊瓧.

Tóm tắt

Câu hỏi thường gặp

Mã Unicode của 中 là gì?

U+4E2D.

Một ký tự Trung Quốc dùng UTF-8 bao nhiêu byte?

Thông thường là ba, và bốn cho các ký tự hiếm hơn U + FFFF.

Sự khác biệt giữa GBK và GB18030 là gì?

GB 18030 mở rộng GBK để bao gồm tất cả Unicode và là tiêu chuẩn quốc gia bắt buộc.

Tại sao CSV của tôi lại hiển thị các ký tự lạ?

Nó có thể được lưu trong một mã hóa và mở trong khác; mở lại với mã hóa chính xác.

HTML là gì?

Chúng hiển thị các ký tự trong trang web bất kể mã hóa trang.

Tin nhắn của tôi đã được tải lên chưa?

Không, chuyển đổi diễn ra trong trình duyệt của bạn.

Hoàn toàn miễn phíKhông phí, không đăng ký
Tệp luôn riêng tưMọi thứ chạy trong trình duyệt của bạn
Dễ dùng bằng ngôn ngữ của bạnCó nhiều ngôn ngữ