Skip to content

Instantly share code, notes, and snippets.

@hideack
Created November 7, 2020 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hideack/e93aace98d15bd1435cf1b034ae89025 to your computer and use it in GitHub Desktop.
Save hideack/e93aace98d15bd1435cf1b034ae89025 to your computer and use it in GitHub Desktop.
shiftjis.js
let files = event.target.files; // ここはファイル選択だったりドラッグ&ドロップのイベントだったりで変わる
let reader = new FileReader();
reader.readAsBinaryString(files[0]);
reader.onload = (ev) => {
const unicodeList = reader.result.split('').map((v) => v.charCodeAt());
const uploadText = Encoding.convert(unicodeList, {to:'UNICODE', from:Encoding.detect(unicodeList), type:'string'});
console.log(uploadText);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment