utf8-to-win1251

1.0.3 • Public • Published

Installation

Via npm:

npm install utf8-to-win1251

Via yarn:

yarn add utf8-to-win1251

In a browser or in Node.js:

import unicodeToWin1251 from 'utf8-to-win1251';

API

This function takes a plain text string (the input parameter) and encodes it according to windows-1251. The return value is an environment-agnostic Uint16Array of which each element represents an octet as per windows-1251.

import unicodeToWin1251 from 'utf8-to-win1251';
import saveAs from 'save-as';

const win1251Array = unicodeToWin1251('Доброго дня!');
const blob = new Blob([win1251Array], {
  type: 'text/plain;charset=windows-1251',
});

saveAs(blob, 'test-file.txt');

text editor example of windows-1251 converted text

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    3
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i utf8-to-win1251

Weekly Downloads

3

Version

1.0.3

License

ISC

Unpacked Size

28.7 kB

Total Files

4

Last publish

Collaborators

  • gregor.horvath