GBK GBK (Chinese Internal Code Specification) Legacy & Platform-Specific
The expanded successor to GB2312 — significantly broader Simplified Chinese character coverage, later itself extended by GB18030 for full Unicode support.
What it is
GBK expanded significantly on GB2312's original ~6,000-character Simplified Chinese coverage, adding thousands more characters (including some Traditional Chinese characters and characters needed for proper names, place names, and technical terms) while remaining backward-compatible with GB2312's existing byte assignments. It became a widely deployed standard through the 1990s before GB18030 later extended coverage even further to reach full Unicode compatibility.
Byte structure
| Byte pattern | Length | Content |
|---|---|---|
| 0x00–0x7F | 1 byte | ASCII-compatible range |
| Two high-bit-set bytes | 2 bytes | Expanded Simplified Chinese character set, backward-compatible with GB2312's assignments plus thousands of additional characters |
Why your text is garbled (symptom → cause)
| Symptom | Likely cause |
|---|---|
| Chinese text shows as unrelated symbols or the "锟斤拷" garbage pattern | GBK/UTF-8 double-decode mismatch, or confusion with Big5 (Traditional Chinese) |
| Common characters decode fine, but some less-common ones don't | Source data may actually be GB18030 (which extends GBK further) rather than strict GBK — try that instead |
| Correctly decoded under GB2312 rules but fails on additional characters | The text uses GBK's expanded character range beyond what plain GB2312 covers — needs a GBK-aware decoder rather than a strict GB2312 one |
Compatibility & gotchas
- Backward-compatible with GB2312 by design — any valid GB2312 byte sequence decodes identically under GBK, which simplified the transition for existing systems.
- Does not cover full Unicode — that gap is what GB18030 was specifically created to close; GBK alone cannot represent every possible Unicode character.
- Not a formal ISO/IEC or GB national standard in the same way GB2312 and GB18030 are — GBK is technically an internal specification (Chinese: 汉字内码扩展规范) that became a de facto industry standard through widespread adoption rather than formal mandate, though GB18030 later formalized and extended its role.
Fixing it
- Command-line conversion:
iconv -f GBK -t UTF-8 input.txt -o output.txt - If some characters fail to decode: try
GB18030instead, since it's a strict superset of GBK and will correctly decode anything GBK can plus more.
Comparison
| Encoding | Key difference from GBK |
|---|---|
| GB2312 | The more limited predecessor GBK is backward-compatible with |
| GB18030 | The further extension covering full Unicode, and the current legally mandated standard for the Chinese market |
| Big5 | Traditional rather than Simplified Chinese, used in a different region |
FAQ
Should I use GBK or GB18030 for new development?
GB18030, generally — it's a strict superset of GBK's coverage, covers full Unicode, and is the current legally required standard for software sold in mainland China. GBK mainly matters today for reading legacy data.
Is GBK the same as "Chinese Windows encoding"?
GBK was widely used as the default Chinese-language encoding on Windows systems for a significant period, though it's not literally a Windows-specific invention — it's a broader industry specification that Windows (among other platforms) adopted.
Fun fact
GBK's name comes from the Chinese "汉字内码扩展规范" (Hanzi Neima Kuozhan Guifan, "Chinese Character Internal Code Extension Specification") — the "GBK" initialism itself reflects "Guojia Biaozhun Kuozhan" (national standard extension), tracing a naming lineage shared with GB2312 and GB18030 despite GBK's own more informal, industry-driven origins.