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

iconv-lite

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iconv-lite - npm Package Compare versions

Comparing version 0.4.9 to 0.4.10

6

Changelog.md
# 0.4.10 / 2015-05-26
* Changed UTF-16 endianness heuristic to take into account any ASCII chars, not
just spaces. This should minimize the importance of "default" endianness.
# 0.4.9 / 2015-05-24

@@ -3,0 +9,0 @@

14

encodings/utf16.js

@@ -154,15 +154,15 @@ "use strict"

// No BOM found. Try to deduce encoding from initial content.
// Most of the time, the content has spaces (U+0020), but the opposite (U+2000) is very uncommon.
// So, we count spaces as if it was LE or BE, and decide from that.
var spacesLE = 0, spacesBE = 0, // Counts of space chars in both positions
// Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.
// So, we count ASCII as if it was LE or BE, and decide from that.
var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions
_len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even.
for (var i = 0; i < _len; i += 2) {
if (buf[i] == 0x00 && buf[i+1] == 0x20) spacesBE++;
if (buf[i] == 0x20 && buf[i+1] == 0x00) spacesLE++;
if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++;
if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++;
}
if (spacesBE > 0 && spacesLE == 0)
if (asciiCharsBE > asciiCharsLE)
enc = 'utf-16be';
else if (spacesBE == 0 && spacesLE > 0)
else if (asciiCharsBE < asciiCharsLE)
enc = 'utf-16le';

@@ -169,0 +169,0 @@ }

{
"name": "iconv-lite",
"description": "Convert character encodings in pure javascript.",
"version": "0.4.9",
"version": "0.4.10",
"license": "MIT",

@@ -6,0 +6,0 @@

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