decode-hex-lib

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i decode-hex-lib

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

3.13 kB

Total Files

5

Last publish

Collaborators

  • aykosn