MCPcopy Index your code
hub / github.com/andris9/encoding / checkEncoding

Function checkEncoding

lib/encoding.js:73–83  ·  view source on GitHub ↗

* Converts charset name if needed * * @param {String} name Character set * @return {String} Character set name

(name)

Source from the content-addressed store, hash-verified

71 * @return {String} Character set name
72 */
73function checkEncoding(name) {
74 return (name || '')
75 .toString()
76 .trim()
77 .replace(/^latin[\-_]?(\d+)$/i, 'ISO-8859-$1')
78 .replace(/^win(?:dows)?[\-_]?(\d+)$/i, 'WINDOWS-$1')
79 .replace(/^utf[\-_]?(\d+)$/i, 'UTF-$1')
80 .replace(/^ks_c_5601\-1987$/i, 'CP949')
81 .replace(/^us[\-_]?ascii$/i, 'ASCII')
82 .toUpperCase();
83}

Callers 1

convertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected