Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sail-sail/iconv_lite

Pure JS character encoding conversion
https://github.com/sail-sail/iconv_lite

Last synced: 21 days ago
JSON representation

Pure JS character encoding conversion

Awesome Lists containing this project

README

        

# iconv_lite

Pure JS character encoding conversion

## usage
```ts
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { decode, encode } from "https://deno.land/x/[email protected]/mod.ts";

const testString = "Hello123!";

Deno.test("utf8", function() {
const enc = "utf8";
const s = decode(encode(testString, enc).toString(enc), enc);
assertEquals(testString, s);
});

Deno.test("UTF-8", function() {
const enc = "UTF-8";
const s = decode(encode(testString, enc).toString(enc), enc);
assertEquals(testString, s);
});

// Deno.test("gbk", function() {
// const enc = "gbk";
// const s = decode(encode(testString, enc).toString(enc), enc);
// assertEquals(testString, s);
// });
```