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

iso-8859-2

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iso-8859-2 - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

2

package.json
{
"name": "iso-8859-2",
"version": "2.0.0",
"version": "3.0.0",
"description": "A robust iso-8859-2 encoder/decoder written in JavaScript.",

@@ -5,0 +5,0 @@ "homepage": "https://mths.be/iso-8859-2",

@@ -31,3 +31,3 @@ # iso-8859-2 [![Build status](https://github.com/mathiasbynens/iso-8859-2/workflows/run-checks/badge.svg)](https://github.com/mathiasbynens/iso-8859-2/actions?query=workflow%3Arun-checks) [![iso-8859-2 on npm](https://img.shields.io/npm/v/iso-8859-2)](https://www.npmjs.com/package/iso-8859-2)

This function takes a plain text string (the `input` parameter) and encodes it according to iso-8859-2. The return value is a ‘byte string’, i.e. a string of which each item represents an octet as per iso-8859-2.
This function takes a plain text string (the `input` parameter) and encodes it according to iso-8859-2. The return value is an environment-agnostic `Uint16Array` of which each element represents an octet as per iso-8859-2.

@@ -38,10 +38,10 @@ ```js

The optional `options` object and its `mode` property can be used to set the [error mode](https://encoding.spec.whatwg.org/#error-mode). For encoding, the error mode can be `'fatal'` (the default) or `'html'`.
The optional `options` object and its `mode` property can be used to set the error mode. The two available error modes are `'fatal'` (the default) or `'replacement'`. (Note: This differs from [the spec](https://encoding.spec.whatwg.org/#error-mode), which recognizes `'fatal`' and `html` modes for encoders. The reason behind this difference is that the spec algorithm is aimed at producing HTML, whereas this library encodes into an environment-agnostic `Uint16Array` of bytes.)
```js
const encodedData = iso88592.encode(text, {
mode: 'html'
mode: 'replacement'
});
// If `text` contains a symbol that cannot be represented in iso-8859-2,
// instead of throwing an error, it will return an HTML entity for the symbol.
// instead of throwing an error, it becomes 0xFFFD.
```

@@ -51,3 +51,3 @@

This function takes a byte string (the `input` parameter) and decodes it according to iso-8859-2.
This function decodes `input` according to iso-8859-2. The `input` parameter can either be a `Uint16Array` of which each element represents an octet as per iso-8859-2, or a ‘byte string’ (i.e. a string of which each item represents an octet as per iso-8859-2).

@@ -68,4 +68,2 @@ ```js

For decoding a buffer (e.g. from `fs.readFile`) use `buffer.toString('binary')` to get the byte string which `decode` takes.
## Notes

@@ -72,0 +70,0 @@

Sorry, the diff of this file is not supported yet

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