Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Ms932.Encoder

import { Ms932 } from "https://raw.githubusercontent.com/i-xi-dev/ms932-encoder.es/2.0.11/mod.ts"; 

const { Encoder } = Ms932;

Windows-31J text encoder

@example
const encoder = new Ms932.Encoder();

encoder.encode("あいうえお");
// → Uint8Array[ 0x82, 0xA0, 0x82, 0xA2, 0x82, 0xA4, 0x82, 0xA6, 0x82, 0xA8 ]

const bytes = new Uint8Array(10);
const { read, written } = encoder.encodeInto("あいうえお", bytes);
// → read: 5
//   written: 10
//   bytes: Uint8Array[ 0x82, 0xA0, 0x82, 0xA2, 0x82, 0xA4, 0x82, 0xA6, 0x82, 0xA8 ]
class Encoder {
constructor(options?: EncoderOptions);
get encoding(): string;
get fatal(): boolean;
 
encode(input?): Uint8Array;
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}

§Constructors

§
new Encoder(options?: EncoderOptions)
[src]
@param options
  • The options for Ms932.Encoder.

§Properties

§
encoding: string readonly
[src]

Gets "shift_jis".

§
fatal: boolean readonly
[src]

Gets true if the error mode is "fatal", otherwise false.

§Methods

§
encode(input?): Uint8Array
[src]
§
encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult
[src]