New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

marc8

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marc8

A Node.js module for converting MARC8 encoding to Unicode

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

Build Status

A Node.js module to convert MARC8 encoded string to UTF-8.

Installation

npm install marc8

Usage

var marc8 = require('marc8');

var options = {
    normalization: 'NFC',
    invalid: 'replace',
    replace: '',
    expandNCR: false
};

marc8(marc8_string, options);

Options

the options parameter is optional. If used, the following options can be set.

  • normalization: by default return NFC normalized, but set :normalization option to: "NFC", "NFD", "NFKC", "NFKD", or false. Set to false for higher performance.
  • expandNCR: By default, escaped unicode 'named character references' in Marc8 will be translated to actuall UTF8. Eg. "‏". But pass expandNCR: false to disable.
  • invalid: Bad Marc8 bytes? By default will throw an error message. Set option invalid: "replace" to instead silently replace bad bytes with a replacement char -- by default Unicode Replacement Char, but can set option replace to something else include empty string.
  • replace: used with the option invalid. For example: marc8(bad_marc8, {invalid: "replace", replace: "")

Example

var marc8 = require('marc8');

var marc8Str = "Conversa\xF0c\xE4ao \xC1";
var unicodeStr = "Conversação \u2113";

var converted = marc8(marc8Str);

console.log(converted === unicodeStr); // will print true

Keywords

MARC

FAQs

Package last updated on 21 Mar 2015

Did you know?

Socket

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.

Install

Related posts