LoginSignup
0
0

【node-cli】readline-syncで日本語が文字化けする

Posted at

事象

interactive.js
const readlineSync = require('readline-sync');
let inputString = readlineSync.question(`文字を入力...`);

console.log(inputString)

Powershellでnode interactive.jsと実行すると、「inputString」はおろか「文字を入力...」の箇所まで文字化けしてしまう。

inputStringをコード上で日本語と一致比較しようにも、全く機能しなくなる。

解決

CtrlPanel>地域>管理>システムロケールの変更>ベータ:ワールドワイド言語サポートでUnicode UTF-8を使用(U) にチェック

0
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
0
0