1.0.0 • Published 6 months ago

decode-hex-lib v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

decode-hex-lib

Library to decode hexadecimal strings into UTF-8 characters.

Description

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

Installation

npm install decode-hex-lib

Import and usage

import { decodeHex } from 'decode-hex-lib';

const encodedString = "S%E3o%20Paulo";
const decodedString = decodeHex(encodedString);
console.log(decodedString); // Output: São Paulo

API

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

Tests

To run the tests, use:

npm test
1.0.0

6 months ago