codepage

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package codepage decodes and encodes the legacy character sets CyberChef supports, reproducing the codepage npm library it uses.

Charsets lists every character set in CyberChef's own order, each with the codepage number Decode and Encode take. The tables are compressed and embedded rather than generated at build time, since together they are large.

Reproducing codepage means reproducing where it departs from the standards: its US-ASCII maps every byte to the code point of the same value, and its UTF-8 does not replace an invalid sequence but reads it as the start of a longer one.

Index

Constants

This section is empty.

Variables

View Source
var Charsets = []cpCharset{}/* 152 elements not displayed */

Charsets lists every CyberChef charset in CHR_ENC_CODE_PAGES order.

Functions

func Decode

func Decode(cp int, data []byte) (string, error)

Decode decodes bytes in the given codepage to a string, reproducing cptable.utils.decode — including cptable's cached SBCS/DBCS paths, which differ from its general (2-byte-first) path.

func Encode

func Encode(cp int, s string) ([]byte, error)

Encode encodes a string into the given codepage, reproducing cptable.utils.encode. For table codepages (cached or general) unmappable code units become the byte 0x00.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL