2011-10-04 UTF-8でエンコード js var p = prompt('UTF-8でエンコードします'); var char = toCharCodeArray(p); var char_hex = toHexString(char); var t = decodeSurrogatePairs(fromCodePointString(char_hex)); console.log(fromCharCodeArray(t)); console.log('\\u'+char_hex); 入力された文字をUTF-8でエンコードする。