← Back to the index

Module std/encoding/sjis.vv

The encoding/sjis module provides Shift-JIS encoding and decoding utilities.

Example:

import sjis from "std/encoding/sjis.vv"

let bytes = sjis.encode('あ')
let res = try sjis.decode(bytes)
console.print(res.char) // 'あ'

Table of Contents

Exports

fun encode(c) extern "native"

Encodes a character to a list of Shift-JIS bytes.

  • c: The character to encode.

Returns a list of integers representing Shift-JIS bytes.

fun decode(bytes) extern "native"

Decodes a list of bytes to a character.

  • bytes: A list of integers representing Shift-JIS bytes.

Returns a result containing a record { char = c, size = n } or an error.