Comparing version 3.1.2 to 3.1.3
{ | ||
"name": "jschardet", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "Character encoding auto-detection in JavaScript (port of python's chardet)", | ||
@@ -5,0 +5,0 @@ "author": "António Afonso", |
@@ -238,11 +238,32 @@ /* | ||
if( this._mInputState == _state.highbyte ) { | ||
for( var i = 0, prober; prober = this._mCharsetProbers[i]; i++ ) { | ||
if( !prober || !prober.getCharsetName() || !canDetectEncoding(prober.getCharsetName()) ) continue; | ||
if (this._mInputState == _state.highbyte) { | ||
let windows_1252_confidence = 0; | ||
let windows_1250_detected = false; | ||
for (var i = 0, prober; prober = this._mCharsetProbers[i]; i++) { | ||
if (!prober) continue; | ||
const charsetName = prober.getCharsetName(); | ||
const confidence = prober.getConfidence(); | ||
if (prober.getCharsetName() === "windows-1252") { | ||
windows_1252_confidence = confidence; | ||
} | ||
if (!charsetName || !canDetectEncoding(charsetName)) continue; | ||
this.results.push({ | ||
"encoding": prober.getCharsetName(), | ||
"confidence": prober.getConfidence() | ||
"confidence": confidence | ||
}); | ||
logger.log(prober.getCharsetName() + " confidence " + prober.getConfidence()); | ||
if (prober.getCharsetName() === "windows-1250") { | ||
windows_1250_detected = true; | ||
} | ||
logger.log(prober.getCharsetName() + " confidence " + confidence); | ||
} | ||
// HACK: When windows-1252 is detected it's almost sure that it can | ||
// also be windows-1250. | ||
// https://en.wikipedia.org/wiki/Windows-1250 (Central European) | ||
if (windows_1252_confidence && !windows_1250_detected && canDetectEncoding("windows-1250")) { | ||
this.results.push({ | ||
"encoding": "windows-1250", | ||
// Report the confidence just a bit under windows-1252's. | ||
"confidence": windows_1252_confidence - Math.pow(5/10, (String(windows_1252_confidence).length - 1)), | ||
}); | ||
} | ||
this.results.sort(function(a, b) { | ||
@@ -249,0 +270,0 @@ return b.confidence - a.confidence; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1320285
16300