Python, Node.jsともに以下の順で変換
16進数文字列 ⇔ バイナリ ⇔ 文字列 ⇔ Unicode(10進数) ⇔ 16進数文字列
そして、デフォルトのエンコーディングはUTF-8
Python
str_data="あ"encoded=str_data.encode()#b'\xe3\x81\x82'
hex_str=encoded.hex()#"e38182"
encoded=bytes.fromhex(hex_str)#b'\xe3\x81\x82'
str_data=encoded.decode()#"あ"
unicode=ord(str_data)#12354
sixteen=hex(unicode)#'0x3042'
unicode=int(sixteen,16)#12354
str_data=chr(unicode)#"あ"
Node.js
letstrData="あ";letencoded=Buffer.from(strData);//<Buffer e3 81 82>lethexStr=encoded.toString("hex");//"e38182"encoded=Buffer.from(hexStr,"hex");//<Buffer e3 81 82>strData=encoded.toString();//"あ"letunicode=strData.codePointAt(0);//12354letsixteen=unicode.toString(16);//'0x3042'unicode=parseInt(sixteen,16);//12354strData=String.fromCodePoint(unicode);//"あ"