utf8BytesHex
This converts a unicode character into the UTF-8 bytes and returns the output as hex.
Created by: hackvertor
Installed 1 times
Category: Charsets
Created on: Monday, November 18, 2024 at 3:25:36 PM
Updated on: Sunday, December 8, 2024 at 6:14:48 PM
Tag arguments
[]
Code
class utf8BytesHex {
encode(input) {
const encoder = new TextEncoder();
const utf8Array = encoder.encode(input);
return Array.from(utf8Array)
.map((byte) => "0x" + byte.toString(16).toUpperCase().padStart(2, "0"))
.join(" ");
}
}