[{"data":1,"prerenderedAt":597},["ShallowReactive",2],{"navigation_docs":3,"-guide-code-pages":108,"-guide-code-pages-surround":592},[4,44],{"title":5,"path":6,"stem":7,"children":8,"icon":43},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Encoding and Decoding","\u002Fguide\u002Fencoding","1.guide\u002F02.encoding",{"title":16,"path":17,"stem":18},"Checksums","\u002Fguide\u002Fchecksums","1.guide\u002F03.checksums",{"title":20,"path":21,"stem":22},"Identify","\u002Fguide\u002Fidentify","1.guide\u002F04.identify",{"title":24,"path":25,"stem":26},"CLI","\u002Fguide\u002Fcli","1.guide\u002F05.cli",{"title":28,"path":29,"stem":30},"Agents","\u002Fguide\u002Fagents","1.guide\u002F06.agents",{"title":32,"path":33,"stem":34},"Code pages","\u002Fguide\u002Fcode-pages","1.guide\u002F07.code-pages",{"title":36,"path":37,"stem":38},"Custom Encodings","\u002Fguide\u002Fcustom","1.guide\u002F08.custom",{"title":40,"path":41,"stem":42},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F09.playground","i-lucide-book-open",{"title":45,"path":46,"stem":47,"children":48,"icon":107},"Encodings","\u002Fencodings","2.encodings\u002F00.index",[49,51,55,59,63,67,71,75,79,83,87,91,95,99,103],{"title":50,"path":46,"stem":47},"Every encoding",{"title":52,"path":53,"stem":54},"Binary","\u002Fencodings\u002Fbinary","2.encodings\u002F01.binary",{"title":56,"path":57,"stem":58},"Octal","\u002Fencodings\u002Foctal","2.encodings\u002F02.octal",{"title":60,"path":61,"stem":62},"Decimal","\u002Fencodings\u002Fdecimal","2.encodings\u002F03.decimal",{"title":64,"path":65,"stem":66},"Hex","\u002Fencodings\u002Fhex","2.encodings\u002F04.hex",{"title":68,"path":69,"stem":70},"Base32","\u002Fencodings\u002Fbase32","2.encodings\u002F05.base32",{"title":72,"path":73,"stem":74},"Base45","\u002Fencodings\u002Fbase45","2.encodings\u002F09.base45",{"title":76,"path":77,"stem":78},"Base58","\u002Fencodings\u002Fbase58","2.encodings\u002F10.base58",{"title":80,"path":81,"stem":82},"Base64","\u002Fencodings\u002Fbase64","2.encodings\u002F14.base64",{"title":84,"path":85,"stem":86},"Base85","\u002Fencodings\u002Fbase85","2.encodings\u002F18.base85",{"title":88,"path":89,"stem":90},"basE91","\u002Fencodings\u002Fbase91","2.encodings\u002F19.base91",{"title":92,"path":93,"stem":94},"Base256","\u002Fencodings\u002Fbase256","2.encodings\u002F20.base256",{"title":96,"path":97,"stem":98},"Bech32","\u002Fencodings\u002Fbech32","2.encodings\u002F21.bech32",{"title":100,"path":101,"stem":102},"uuencode","\u002Fencodings\u002Fuuencode","2.encodings\u002F22.uuencode",{"title":104,"path":105,"stem":106},"Quoted-Printable","\u002Fencodings\u002Fquoted-printable","2.encodings\u002F23.quoted-printable","i-lucide-library",{"id":109,"title":32,"body":110,"description":586,"extension":587,"links":588,"meta":589,"navigation":172,"path":33,"seo":590,"stem":34,"__hash__":591},"docs\u002F1.guide\u002F07.code-pages.md",{"type":111,"value":112,"toc":580},"minimark",[113,118,135,239,255,259,385,392,396,399,453,460,464,522,562,569,576],[114,115,117],"h2",{"id":116},"bytes-in-a-different-character-set","Bytes in a different character set",[119,120,121,122,126,127,130,131,134],"p",{},"Every encoding here writes bytes as text. A code page doesn't. It says which character each byte already is. Byte ",[123,124,125],"code",{},"0xC8"," is ",[123,128,129],{},"È"," in Latin-1 and ",[123,132,133],{},"H"," on an IBM mainframe. Same byte, different letter.",[136,137,142],"pre",{"className":138,"code":139,"language":140,"meta":141,"style":141},"language-ts shiki shiki-themes encodings encodings encodings","import { charsets, hex } from \"@agntn\u002Fencodings\";\n\ncharsets.toText(hex.decode(\"c8c5d3d3d640e6d6d9d3c4\"), { codepage: \"ibm037\" });\n\u002F\u002F \"HELLO WORLD\"\ncharsets.fromText(\"Grüße\", { codepage: \"ibm273\" });\n\u002F\u002F Uint8Array [0xc7, 0x99, 0xd0, 0xa1, 0x85]\n","ts","",[123,143,144,167,174,205,212,233],{"__ignoreMap":141},[145,146,149,153,157,160,164],"span",{"class":147,"line":148},"line",1,[145,150,152],{"class":151},"skH_V","import",[145,154,156],{"class":155},"s38Sx"," { charsets, hex } ",[145,158,159],{"class":151},"from",[145,161,163],{"class":162},"shU9J"," \"@agntn\u002Fencodings\"",[145,165,166],{"class":155},";\n",[145,168,170],{"class":147,"line":169},2,[145,171,173],{"emptyLinePlaceholder":172},true,"\n",[145,175,177,180,184,187,190,193,196,199,202],{"class":147,"line":176},3,[145,178,179],{"class":155},"charsets.",[145,181,183],{"class":182},"sK71F","toText",[145,185,186],{"class":155},"(hex.",[145,188,189],{"class":182},"decode",[145,191,192],{"class":155},"(",[145,194,195],{"class":162},"\"c8c5d3d3d640e6d6d9d3c4\"",[145,197,198],{"class":155},"), { codepage: ",[145,200,201],{"class":162},"\"ibm037\"",[145,203,204],{"class":155}," });\n",[145,206,208],{"class":147,"line":207},4,[145,209,211],{"class":210},"scIB-","\u002F\u002F \"HELLO WORLD\"\n",[145,213,215,217,220,222,225,228,231],{"class":147,"line":214},5,[145,216,179],{"class":155},[145,218,219],{"class":182},"fromText",[145,221,192],{"class":155},[145,223,224],{"class":162},"\"Grüße\"",[145,226,227],{"class":155},", { codepage: ",[145,229,230],{"class":162},"\"ibm273\"",[145,232,204],{"class":155},[145,234,236],{"class":147,"line":235},6,[145,237,238],{"class":210},"\u002F\u002F Uint8Array [0xc7, 0x99, 0xd0, 0xa1, 0x85]\n",[119,240,241,243,244,246,247,250,251,254],{},[123,242,183],{}," reads bytes, one character each. ",[123,245,219],{}," goes back. A character the page doesn't have throws a ",[123,248,249],{},"DecodeError"," with its index. No ",[123,252,253],{},"?",", no guess.",[114,256,258],{"id":257},"which-pages","Which pages?",[260,261,262,277],"table",{},[263,264,265],"thead",{},[266,267,268,274],"tr",{},[269,270,271],"th",{},[123,272,273],{},"codepage",[269,275,276],{},"What it is",[278,279,280,291,315,325,350,366],"tbody",{},[266,281,282,288],{},[283,284,285],"td",{},[123,286,287],{},"ibm037",[283,289,290],{},"EBCDIC for the US and Canada",[266,292,293,298],{},[283,294,295],{},[123,296,297],{},"ibm273",[283,299,300,301,304,305,304,308,311,312],{},"EBCDIC for Germany and Austria, with ",[123,302,303],{},"ä",", ",[123,306,307],{},"ö",[123,309,310],{},"ü"," and ",[123,313,314],{},"ß",[266,316,317,322],{},[283,318,319],{},[123,320,321],{},"ibm500",[283,323,324],{},"EBCDIC, the international one",[266,326,327,335],{},[283,328,329,304,332],{},[123,330,331],{},"ibm1140",[123,333,334],{},"ibm1141",[283,336,337,338,341,342,345,346,349],{},"037 and 273 with ",[123,339,340],{},"€"," on byte ",[123,343,344],{},"0x9F",", where ",[123,347,348],{},"¤"," used to be",[266,351,352,357],{},[283,353,354],{},[123,355,356],{},"latin1",[283,358,359,360,363,364],{},"ISO 8859-1. Byte ",[123,361,362],{},"n"," is code point ",[123,365,362],{},[266,367,368,373],{},[283,369,370],{},[123,371,372],{},"windows1252",[283,374,375,376,378,379,382,383],{},"What a browser calls Latin-1. Smart quotes and ",[123,377,340],{}," on ",[123,380,381],{},"0x80"," to ",[123,384,344],{},[119,386,387,388,391],{},"The EBCDIC tables come from IBM's own mappings, checked against glibc ",[123,389,390],{},"iconv",". Windows-1252 reads the five bytes Microsoft never assigned as the C1 controls, the way every browser does.",[114,393,395],{"id":394},"mojibake","Mojibake",[119,397,398],{},"Mojibake is text shown in the wrong code page. So you undo it in two steps. Read the text in the page it was shown in, then read those bytes in the page they were written in.",[136,400,402],{"className":138,"code":401,"language":140,"meta":141,"style":141},"const bytes = charsets.fromText(\"ÎÈ,Îø%_\", { codepage: \"ibm1141\" });\nnew TextDecoder().decode(bytes);\n\u002F\u002F \"vtkvplm\"\n",[123,403,404,432,448],{"__ignoreMap":141},[145,405,406,409,412,415,418,420,422,425,427,430],{"class":147,"line":148},[145,407,408],{"class":151},"const",[145,410,411],{"class":155}," bytes ",[145,413,414],{"class":151},"=",[145,416,417],{"class":155}," charsets.",[145,419,219],{"class":182},[145,421,192],{"class":155},[145,423,424],{"class":162},"\"ÎÈ,Îø%_\"",[145,426,227],{"class":155},[145,428,429],{"class":162},"\"ibm1141\"",[145,431,204],{"class":155},[145,433,434,437,440,443,445],{"class":147,"line":169},[145,435,436],{"class":151},"new",[145,438,439],{"class":182}," TextDecoder",[145,441,442],{"class":155},"().",[145,444,189],{"class":182},[145,446,447],{"class":155},"(bytes);\n",[145,449,450],{"class":147,"line":176},[145,451,452],{"class":210},"\u002F\u002F \"vtkvplm\"\n",[119,454,455,456,459],{},"Plain ASCII letters, printed as EBCDIC 1141. That's how a puzzle hides a Beaufort ciphertext in plain sight. Looks like line noise, turns out to be lowercase letters. Which page was it? Nothing in the text tells you, so ",[123,457,458],{},"identify"," doesn't guess. Try the likely ones.",[114,461,463],{"id":462},"cli-and-agents","CLI and agents",[136,465,469],{"className":466,"code":467,"language":468,"meta":141,"style":141},"language-bash shiki shiki-themes encodings encodings encodings","encodings convert c8c5d3d3d640e6d6d9d3c4 --from hex --to ibm037\n# HELLO WORLD\n\nencodings convert 'ÎÈ,Îø%_' --from ibm1141\n# vtkvplm\n","bash",[123,470,471,494,499,503,517],{"__ignoreMap":141},[145,472,473,476,479,482,485,488,491],{"class":147,"line":148},[145,474,475],{"class":182},"encodings",[145,477,478],{"class":162}," convert",[145,480,481],{"class":162}," c8c5d3d3d640e6d6d9d3c4",[145,483,484],{"class":162}," --from",[145,486,487],{"class":162}," hex",[145,489,490],{"class":162}," --to",[145,492,493],{"class":162}," ibm037\n",[145,495,496],{"class":147,"line":169},[145,497,498],{"class":210},"# HELLO WORLD\n",[145,500,501],{"class":147,"line":176},[145,502,173],{"emptyLinePlaceholder":172},[145,504,505,507,509,512,514],{"class":147,"line":207},[145,506,475],{"class":182},[145,508,478],{"class":162},[145,510,511],{"class":162}," 'ÎÈ,Îø%_'",[145,513,484],{"class":162},[145,515,516],{"class":162}," ibm1141\n",[145,518,519],{"class":147,"line":214},[145,520,521],{"class":210},"# vtkvplm\n",[119,523,524,527,528,531,532,535,536,304,538,304,541,544,545,548,549,552,553,304,556,311,558,561],{},[123,525,526],{},"--from"," turns the input into bytes, ",[123,529,530],{},"--to"," writes them back, ",[123,533,534],{},"utf8"," by default. Both take a code page, ",[123,537,534],{},[123,539,540],{},"hex",[123,542,543],{},"base64"," or ",[123,546,547],{},"raw",". Agents get the same thing as ",[123,550,551],{},"encodings_charset_convert",", with ",[123,554,555],{},"text",[123,557,159],{},[123,559,560],{},"to",".",[136,563,567],{"className":564,"code":566,"language":555,"meta":141},[565],"language-text","hex → 11 bytes → ibm037:\n\"HELLO WORLD\"\n",[123,568,566],{"__ignoreMap":141},[119,570,571,572,575],{},"The subpath is ",[123,573,574],{},"@agntn\u002Fencodings\u002Fcharsets",", if the tables are all you need.",[577,578,579],"style",{},"html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html pre.shiki code .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":141,"searchDepth":169,"depth":169,"links":581},[582,583,584,585],{"id":116,"depth":169,"text":117},{"id":257,"depth":169,"text":258},{"id":394,"depth":169,"text":395},{"id":462,"depth":169,"text":463},"EBCDIC and Latin-1 and Windows-1252. Read bytes as text in another character set or turn mojibake back into what it was","md",null,{},{"title":32,"description":586},"SnwY4vEWdsmBZYkdmksKCsdFhKo891gI7PafAZMaHLk",[593,595],{"title":28,"path":29,"stem":30,"description":594,"children":-1},"The same tools over MCP and Pi and OMP and the AI SDK. What they take and what they refuse and what the model reads back",{"title":36,"path":37,"stem":38,"description":596,"children":-1},"An encoding is one object with a name and info and encode and decode. Register it and everything sees it",1790982432219]