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

codepage

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codepage - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

21

cputils.js

@@ -298,4 +298,5 @@ /* cputils.js (C) 2013-present SheetJS -- http://sheetjs.com */

var C = cpt[cp], E, M = "";
var isstr = typeof data === 'string';
if(C && (E=C.enc)) for(i = 0; i < len; ++i, ++j) {
w = E[data[i]];
w = E[isstr? data.charAt(i) : data[i]];
if(w > 255) {

@@ -308,5 +309,5 @@ out[j] = w>>8;

case "utf8":
if(has_buf && typeof data === "string") { out = new Buffer(data, M); j = out.length; break; }
if(has_buf && isstr) { out = new Buffer(data, M); j = out.length; break; }
for(i = 0; i < len; ++i, ++j) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w <= 0x007F) out[j] = w;

@@ -318,3 +319,3 @@ else if(w <= 0x07FF) {

w -= 0xD800;
ww = data[++i].charCodeAt(0) - 0xDC00 + (w << 10);
ww = (isstr ? data.charCodeAt(++i) : data[++i].charCodeAt(0)) - 0xDC00 + (w << 10);
out[j] = 240 + ((ww>>>18) & 0x07);

@@ -334,3 +335,3 @@ out[++j] = 144 + ((ww>>>12) & 0x3F);

for(i = 0; i < len; ++i, ++j) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w <= 0x007F) out[j] = w;

@@ -343,3 +344,3 @@ else throw new Error("bad ascii " + w);

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
out[j++] = w&255;

@@ -351,3 +352,3 @@ out[j++] = w>>8;

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
out[j++] = w>>8;

@@ -359,3 +360,3 @@ out[j++] = w&255;

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w >= 0xD800 && w <= 0xDFFF) w = 0x10000 + ((w - 0xD800) << 10) + (data[++i].charCodeAt(0) - 0xDC00);

@@ -370,3 +371,3 @@ out[j++] = w&255; w >>= 8;

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w >= 0xD800 && w <= 0xDFFF) w = 0x10000 + ((w - 0xD800) << 10) + (data[++i].charCodeAt(0) - 0xDC00);

@@ -382,3 +383,3 @@ out[j+3] = w&255; w >>= 8;

for(i = 0; i < len; i++) {
var c = data[i];
var c = isstr ? data.charAt(i) : data[i].charAt(0);
if(c === "+") { out[j++] = 0x2b; out[j++] = 0x2d; continue; }

@@ -385,0 +386,0 @@ if(SetD.indexOf(c) > -1) { out[j++] = c.charCodeAt(0); continue; }

@@ -298,4 +298,5 @@ /* cputils.js (C) 2013-present SheetJS -- http://sheetjs.com */

var C = cpt[cp], E, M = "";
var isstr = typeof data === 'string';
if(C && (E=C.enc)) for(i = 0; i < len; ++i, ++j) {
w = E[data[i]];
w = E[isstr? data.charAt(i) : data[i]];
if(w > 255) {

@@ -308,5 +309,5 @@ out[j] = w>>8;

case "utf8":
if(has_buf && typeof data === "string") { out = new Buffer(data, M); j = out.length; break; }
if(has_buf && isstr) { out = new Buffer(data, M); j = out.length; break; }
for(i = 0; i < len; ++i, ++j) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w <= 0x007F) out[j] = w;

@@ -318,3 +319,3 @@ else if(w <= 0x07FF) {

w -= 0xD800;
ww = data[++i].charCodeAt(0) - 0xDC00 + (w << 10);
ww = (isstr ? data.charCodeAt(++i) : data[++i].charCodeAt(0)) - 0xDC00 + (w << 10);
out[j] = 240 + ((ww>>>18) & 0x07);

@@ -334,3 +335,3 @@ out[++j] = 144 + ((ww>>>12) & 0x3F);

for(i = 0; i < len; ++i, ++j) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w <= 0x007F) out[j] = w;

@@ -343,3 +344,3 @@ else throw new Error("bad ascii " + w);

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
out[j++] = w&255;

@@ -351,3 +352,3 @@ out[j++] = w>>8;

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
out[j++] = w>>8;

@@ -359,3 +360,3 @@ out[j++] = w&255;

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w >= 0xD800 && w <= 0xDFFF) w = 0x10000 + ((w - 0xD800) << 10) + (data[++i].charCodeAt(0) - 0xDC00);

@@ -370,3 +371,3 @@ out[j++] = w&255; w >>= 8;

for(i = 0; i < len; ++i) {
w = data[i].charCodeAt(0);
w = isstr ? data.charCodeAt(i) : data[i].charCodeAt(0);
if(w >= 0xD800 && w <= 0xDFFF) w = 0x10000 + ((w - 0xD800) << 10) + (data[++i].charCodeAt(0) - 0xDC00);

@@ -382,3 +383,3 @@ out[j+3] = w&255; w >>= 8;

for(i = 0; i < len; i++) {
var c = data[i];
var c = isstr ? data.charAt(i) : data[i].charAt(0);
if(c === "+") { out[j++] = 0x2b; out[j++] = 0x2d; continue; }

@@ -385,0 +386,0 @@ if(SetD.indexOf(c) > -1) { out[j++] = c.charCodeAt(0); continue; }

{
"name": "codepage",
"version": "1.5.0",
"version": "1.6.0",
"author": "SheetJS",

@@ -5,0 +5,0 @@ "description": "pure-JS library to handle codepages",

@@ -1,2 +0,2 @@

# Codepages for JS
# js-codepage

@@ -7,7 +7,2 @@ [Codepages](https://en.wikipedia.org/wiki/Codepage) are character encodings. In

[unicode.org](http://www.unicode.org/Public/MAPPINGS/) hosts lists of mappings.
The build script automatically downloads and parses the mappings in order to
generate the full script. The `pages.csv` description in `codepage.md` controls
which codepages are used.
## Setup

@@ -17,12 +12,18 @@

var cptable = require('codepage');
```js
var cptable = require('codepage');
```
In the browser:
<script src="cptable.js"></script>
<script src="cputils.js"></script>
```html
<script src="cptable.js"></script>
<script src="cputils.js"></script>
```
Alternatively, use the full version in the dist folder:
<script src="cptable.full.js"></script>
```html
<script src="cptable.full.js"></script>
```

@@ -37,8 +38,10 @@ The complete set of codepages is large due to some Double Byte Character Set

<script src="bits/10000.js"></script>
<script src="bits/10006.js"></script>
<script src="bits/10007.js"></script>
<script src="bits/10029.js"></script>
<script src="bits/10079.js"></script>
<script src="bits/10081.js"></script>
```html
<script src="bits/10000.js"></script>
<script src="bits/10006.js"></script>
<script src="bits/10007.js"></script>
<script src="bits/10029.js"></script>
<script src="bits/10079.js"></script>
<script src="bits/10081.js"></script>
```

@@ -82,2 +85,5 @@ All of the browser scripts define and append to the `cptable` object. To rename

`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or
Buffer and returns a JS string.
## Known Excel Codepages

@@ -103,3 +109,3 @@

```bash
bash make.sh path_to_manifest output_file_name JSVAR
$ bash make.sh path_to_manifest output_file_name JSVAR
```

@@ -115,3 +121,5 @@

<codepage number>,<source>,<size>
```
<codepage number>,<source>,<size>
```

@@ -313,2 +321,11 @@ If a source is specified, it will try to download the specified file and parse.

## Testing
`make test` will run the nodejs-based test.
To run the in-browser tests, run a local server and go to the `ctest` directory.
`make ctestserv` will start a python `SimpleHTTPServer` server on port 8000.
To update the browser artifacts, run `make ctest`.
## Sources

@@ -321,6 +338,15 @@

## License
Please consult the attached LICENSE file for details. All rights not explicitly
granted by the Apache 2.0 license are reserved by the Original Author.
## Badges
[![Sauce Test Status](https://saucelabs.com/browser-matrix/codepage.svg)](https://saucelabs.com/u/codepage)
[![Build Status](https://travis-ci.org/SheetJS/js-codepage.svg?branch=master)](https://travis-ci.org/SheetJS/js-codepage)
[![Coverage Status](https://coveralls.io/repos/SheetJS/js-codepage/badge.png)](https://coveralls.io/r/SheetJS/js-codepage)
[![Coverage Status](http://img.shields.io/coveralls/SheetJS/js-codepage/master.svg)](https://coveralls.io/r/SheetJS/js-codepage?branch=master)
[![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/js-codepage?pixel)](https://github.com/SheetJS/js-codepage)

Sorry, the diff of this file is not supported yet

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