UNPKG

fix-latin1-to-utf8

Version:

Fix mojibake when converting Latin-1 encoded text to UTF-8

19 lines (18 loc) 765 B
export = fixLatin1ToUtf8; /** * @author Frazer Smith * @description Fixes common encoding errors when converting from Latin-1 (and Windows-1252) to UTF-8. * @see {@link https://www.i18nqa.com/debug/utf8-debug.html | UTF-8 Encoding Debugging Chart} * @param {string} str - The string to be converted. * @returns {string} The converted string. * @throws {TypeError} If the argument is not a string. */ declare function fixLatin1ToUtf8(str: string): string; declare namespace fixLatin1ToUtf8 { export { fixLatin1ToUtf8 as default, fixLatin1ToUtf8, REPLACEMENTS }; } /** * @description Latin-1 characters and their corresponding UTF-8 characters. * @type {Readonly<Record<string, string>>} */ declare const REPLACEMENTS: Readonly<Record<string, string>>;