1
0

More than 1 year has passed since last update.

Node.js Shift-JISに変換する方法

Posted at

Node.jsで簡単に文字列をShift_JISに変換する方法を明記します。

環境: Mac OSX

利用するライブラリ iconv-lite
まずはライブラリのインストールをします。

ターミナル
$npm install --save iconv-lite
convert.ts
import {convert} from 'iconv-lite';

const str = '変換したい文字列';
const encoded = encode(str, 'SJIS'); //文字列をShift_JISに変換
console.log(encoded);
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0