diff --git a/README.md b/README.md index 3c73986..93fed66 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Convert and detect character encoding in JavaScript. - [Installation](#installation) * [npm](#npm) + [TypeScript](#typescript) - * [browser (standalone)](#browser-standalone) + * [Browser (standalone)](#browser-standalone) * [CDN](#cdn) - [Supported encodings](#supported-encodings) * [About `UNICODE`](#about-unicode) @@ -70,16 +70,16 @@ which can then be passed as strings. encoding.js is published under the package name `encoding-japanese` on npm. ```bash -$ npm install --save encoding-japanese +npm install --save encoding-japanese ``` -#### using `import` +#### Using ES6 `import` ```javascript import Encoding from 'encoding-japanese'; ``` -#### using `require` +#### Using CommonJS `require` ```javascript const Encoding = require('encoding-japanese'); @@ -87,28 +87,28 @@ const Encoding = require('encoding-japanese'); #### TypeScript -TypeScript type definitions for encoding.js are available at [@types/encoding-japanese](https://www.npmjs.com/package/@types/encoding-japanese) (thanks [@rhysd](https://github.com/rhysd)). +TypeScript type definitions for encoding.js are available at [@types/encoding-japanese](https://www.npmjs.com/package/@types/encoding-japanese) (thanks to [@rhysd](https://github.com/rhysd)). ```bash -$ npm install --save-dev @types/encoding-japanese +npm install --save-dev @types/encoding-japanese ``` -### browser (standalone) +### Browser (standalone) -Install from npm or download from the [release list](https://github.com/polygonplanet/encoding.js/tags) and use `encoding.js` or `encoding.min.js` in the package. -\*Please note that if you `git clone`, even the *master* branch may be under development. +To use encoding.js in a browser environment, you can either install it via npm or download it directly from the [release list](https://github.com/polygonplanet/encoding.js/tags). +The package includes both `encoding.js` and `encoding.min.js`. + +Note: Cloning the repository via `git clone` might give you access to the *master* (or *main*) branch, which could still be in a development state. ```html + -``` -Or use the minified `encoding.min.js` - -```html + ``` -When the script is loaded, the object `Encoding` is defined in the global scope (ie `window.Encoding`). +When the script is loaded, the object `Encoding` is defined in the global scope (i.e., `window.Encoding`). ### CDN diff --git a/README_ja.md b/README_ja.md index d1958a8..ee6f439 100644 --- a/README_ja.md +++ b/README_ja.md @@ -42,7 +42,7 @@ JavaScript で文字コードの変換や判定をします。 ## 特徴 encoding.js は、文字コードの変換や判定をする JavaScript ライブラリです。 -Shift_JIS や EUC-JP、JIS など日本語の文字コードや、 UTF-8、UTF-16 などの Unicode に対応しています。 +`Shift_JIS` や `EUC-JP`、`ISO-2022-JP` など日本語の文字コードや、 `UTF-8`、`UTF-16` などの Unicode に対応しています。 JavaScript の文字列は内部で UTF-16 コードユニットとして符号化されるため、文字列のままでは他の文字コードを正しく扱えませんが ([参照: ECMAScript® 2019 Language Specification - 6.1.4 The String Type](https://www.ecma-international.org/ecma-262/10.0/index.html#sec-ecmascript-language-types-string-type))、encoding.js では文字列ではなく配列として扱い変換を実現しています。 各文字コードは、例えば `[130, 160]` (UTF-8の「あ」) などの文字コード値を持つ数値の配列として扱います。