Library to decode hexadecimal strings into UTF-8 characters.
This library provides a function to decode strings containing hexadecimal codes preceded by % (e.g., %F3) into their respective UTF-8 characters.
Link to Latin-1 character table: https://en.wikipedia.org/wiki/ISO/IEC_8859-1
npm install decode-hex-lib
import { decodeHex } from 'decode-hex-lib';
const encodedString = "S%E3o%20Paulo";
const decodedString = decodeHex(encodedString);
console.log(decodedString); // Output: São Paulo
decodeHex(encodedString: string): string Decodes a hexadecimal string to a UTF-8 string.
encodedString: The string to be decoded. Returns: The decoded string.
decodeHex("Gest%E3o"); // Retorna: Gestão
decodeHex("%C9poca"); // Retorna: Época
To run the tests, use:
npm test