![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
iso-8859-16
Advanced tools
iso-8859-16 is a robust JavaScript implementation of the iso-8859-16 character encoding as defined by the Encoding Standard.
This encoding is known under the following names: , and iso-8859-16.
Via npm:
npm install iso-8859-16
In a browser or in Node.js:
import {encode, decode, labels} from 'iso-8859-16';
// or…
import * as iso885916 from 'iso-8859-16';
iso885916.labels
An array of strings, each representing a label for this encoding.
iso885916.encode(input, options)
This function takes a plain text string (the input
parameter) and encodes it according to iso-8859-16. The return value is an environment-agnostic Uint16Array
of which each element represents an octet as per iso-8859-16.
const encodedData = iso885916.encode(text);
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, 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.)
const encodedData = iso885916.encode(text, {
mode: 'replacement'
});
// If `text` contains a symbol that cannot be represented in iso-8859-16,
// instead of throwing an error, it becomes 0xFFFD.
iso885916.decode(input, options)
This function decodes input
according to iso-8859-16. The input
parameter can either be a Uint16Array
of which each element represents an octet as per iso-8859-16, or a ‘byte string’ (i.e. a string of which each item represents an octet as per iso-8859-16).
const text = iso885916.decode(encodedData);
The optional options
object and its mode
property can be used to set the error mode. For decoding, the error mode can be 'replacement'
(the default) or 'fatal'
.
const text = iso885916.decode(encodedData, {
mode: 'fatal'
});
// If `encodedData` contains an invalid byte for the iso-8859-16 encoding,
// instead of replacing it with U+FFFD in the output, an error is thrown.
Similar modules for other single-byte legacy encodings are available.
Mathias Bynens |
iso-8859-16 is available under the MIT license.
FAQs
A robust iso-8859-16 encoder/decoder written in JavaScript.
The npm package iso-8859-16 receives a total of 9 weekly downloads. As such, iso-8859-16 popularity was classified as not popular.
We found that iso-8859-16 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.