Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jschardet

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jschardet - npm Package Compare versions

Comparing version 1.4.2 to 1.5.0

LICENSE

2

package.json
{
"name": "jschardet",
"version": "1.4.2",
"version": "1.5.0",
"description": "Character encoding auto-detection in JavaScript (port of python's chardet)",

@@ -5,0 +5,0 @@ "main": "src/init",

@@ -36,2 +36,4 @@ /*

var SURE_NO = 0.01;
var MINIMUM_DATA_THRESHOLD = 3;
var self = this;

@@ -81,3 +83,3 @@

// if we didn't receive any character in our consideration range, return negative answer
if( this._mTotalChars <= 0 ) {
if( this._mTotalChars <= 0 || this._mFreqChars <= MINIMUM_DATA_THRESHOLD) {
return SURE_NO;

@@ -237,4 +239,4 @@ }

// for sjis encoding, we are interested
// first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
// second byte range: 0x40 -- 0x7e, 0x81 -- 0xfe
// first byte range: 0x81 -- 0x9f , 0xe0 -- 0xef
// second byte range: 0x40 -- 0x7e, 0x80 -- 0xfc
// no validation needed here. State machine has done that

@@ -249,3 +251,3 @@ if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) {

order += aStr.charCodeAt(1) - 0x40;
if( aStr.charCodeAt(1) > 0x7F ) {
if( aStr.charCodeAt(1) < 0x40 || aStr.charCodeAt(1) === 0x7F || aStr.charCodeAt(1) > 0xFC) {
order = -1;

@@ -252,0 +254,0 @@ }

@@ -346,4 +346,4 @@ /*

3,3,3,3,3,4,4,4, // e8 - ef
4,4,4,4,4,4,4,4, // f0 - f7
4,4,4,4,4,0,0,0 // f8 - ff
3,3,3,3,3,3,3,3, // f0 - f7
3,3,3,3,3,0,0,0 // f8 - ff
];

@@ -350,0 +350,0 @@

@@ -145,2 +145,6 @@ /*

equals( jschardet.detect(str).encoding, "windows-1252" );
// <string>Martin Kühl</string>
var str = "\x3c\x73\x74\x72\x69\x6e\x67\x3e\x4d\x61\x72\x74\x69\x6e\x20\x4b\xfc\x68\x6c\x3c\x2f\x73\x74\x72\x69\x6e\x67\x3e";
equals( jschardet.detect(str).encoding, "windows-1252" );
});

@@ -231,2 +235,2 @@

equals( jschardet.detect(str).encoding, "HZ-GB-2312" );
});
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc