Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

encoding-japanese

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encoding-japanese

Convert and detect character encoding in JavaScript

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is encoding-japanese?

The encoding-japanese npm package provides functionalities for encoding and decoding Japanese text. It supports various character encodings such as UTF-8, Shift_JIS, EUC-JP, and ISO-2022-JP. The package is useful for converting between different encodings, detecting encoding types, and handling Japanese text in web applications.

What are encoding-japanese's main functionalities?

Encoding Conversion

This feature allows you to convert text from one encoding to another. In this example, the Japanese text 'こんにちは' is converted to a UTF-8 byte array.

const Encoding = require('encoding-japanese');
const utf8Array = Encoding.convert('こんにちは', 'UTF8');
console.log(utf8Array);

Encoding Detection

This feature detects the encoding of a given byte array. In this example, the byte array is detected to determine its encoding.

const Encoding = require('encoding-japanese');
const detectedEncoding = Encoding.detect(new Uint8Array([0x82, 0xa0, 0x82, 0xa2, 0x82, 0xa4]));
console.log(detectedEncoding);

String to Byte Array

This feature converts a string to a byte array. In this example, the Japanese text 'こんにちは' is converted to a byte array.

const Encoding = require('encoding-japanese');
const byteArray = Encoding.stringToCode('こんにちは');
console.log(byteArray);

Byte Array to String

This feature converts a byte array back to a string. In this example, a byte array is converted back to the Japanese text 'こんにちは'.

const Encoding = require('encoding-japanese');
const byteArray = [0x82, 0xa0, 0x82, 0xa2, 0x82, 0xa4];
const string = Encoding.codeToString(byteArray);
console.log(string);

Other packages similar to encoding-japanese

Keywords

FAQs

Package last updated on 08 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc