{"id":18326445,"url":"https://github.com/limoer96/ncr-decode","last_synced_at":"2025-04-09T16:25:08.535Z","repository":{"id":44013091,"uuid":"199100950","full_name":"Limoer96/ncr-decode","owner":"Limoer96","description":"A Tool to decode numeric character reference(NCR).","archived":false,"fork":false,"pushed_at":"2023-01-05T05:14:37.000Z","size":655,"stargazers_count":3,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T17:05:33.590Z","etag":null,"topics":["cli","ncr","ncr-string"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Limoer96.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-27T01:35:20.000Z","updated_at":"2024-06-15T06:52:52.000Z","dependencies_parsed_at":"2023-02-03T12:10:11.284Z","dependency_job_id":null,"html_url":"https://github.com/Limoer96/ncr-decode","commit_stats":null,"previous_names":["xiaomoer/ncr-decode"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Limoer96%2Fncr-decode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Limoer96%2Fncr-decode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Limoer96%2Fncr-decode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Limoer96%2Fncr-decode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Limoer96","download_url":"https://codeload.github.com/Limoer96/ncr-decode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248066284,"owners_count":21042074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","ncr","ncr-string"],"created_at":"2024-11-05T19:06:56.724Z","updated_at":"2025-04-09T16:25:08.496Z","avatar_url":"https://github.com/Limoer96.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ncr-decode\r\n\r\n\u003e A Tool to decode numeric character reference(NCR).\r\n\r\n## what is NCR?\r\n\r\n\u003e numeric character reference(**NCR**) is similar to **HTML Entities**. **NCR** consists of two parts. prefix: \"\u0026#\" or \"\u0026#x\", body: Unicode code point. We offten see it in html, xml or even in dfm file(Delphi Form File).\r\n\r\nthere are some **NCR** string below:\r\n\r\n```\r\n\u0026#23435;\u0026#20307;\r\n\u0026#x4e2d;\u0026#x56fd;\r\n#23435#20307 (NRC in dfm)\r\n```\r\n\r\n## What's this?\r\n\r\n1. A tool to decode NCR string;\r\n2. A tool to decode NCR in `.dfm` file;\r\n3. A cli to decode NCR string.\r\n4. encode string to NCR.(new)\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install --save ncr-decode\r\n```\r\n\r\nuse the cli\r\n\r\n```bash\r\nnpm install -g ncr-decode\r\n```\r\n\r\nsee from [npm package](https://npmjs.org/package/ncr-decode).\r\n\r\n## Usage\r\n\r\n```javascript\r\nconst ncrd = require('ncr-decode')\r\nconsole.log(ncrd.encode('宋体')) // \u0026#23435;\u0026#20307;\r\nconsole.log(ncrd.encode('宋体', 16)) // \u0026#x5b8b;\u0026#x4f53;\r\nconsole.log(ncrd.decode('\u0026#23435;\u0026#20307;')) // 宋体\r\nconsole.log(ncrd.decode('Tim, \u0026#20320;\u0026#22909')) // Tim, 你好\r\nconsole.log(ncrd.dfmDecode('#23435#20307')) // 宋体\r\nconsole.log(ncrd.dfmDecode('\u0026#23435;\u0026#20307;')) // 宋体\r\n```\r\n\r\n### Client\r\n\r\n#### REPL\r\n\r\n```\r\nPS C:\\Users\\limoer\\www\\dfmdecode\u003e ncrd\r\nenter `.exit` to exit.\r\n\u003e \u0026#23435;\u0026#20307;\r\n宋体\r\n\u003e #23435#20307\r\n宋体\r\n\u003e Tom, \u0026#20320;\u0026#22909;\r\nTom, 你好\r\n\u003e 123\r\n[!invalid]  123\r\n\r\n```\r\n\r\n#### CLI\r\n\r\n```\r\nUsage: ncrd [options] [\u003cinput string\u003e]\r\n\r\n  -i, --inline\r\n    inline mode, convert the input string\r\n  \u003cinput string\u003e\r\n    NCR string or NCR string in dfm, if type the wrong type, just return.\r\n```\r\n\r\n### API\r\n\r\n```javascript\r\n/**\r\n * numerric character reference(NCR) decode\r\n * @param {string} str ncr string\r\n * @return {string}\r\n */\r\nfunction ncrDecode(str) {...}\r\n\r\n/**\r\n * NCR in dfm to NCR string\r\n * @param {string} str\r\n * @return {string}\r\n */\r\n// [!Deprecated]use ncrEncode instead\r\n// function str2NCR(str) {...}\r\n\r\n/**\r\n * string to NCR string\r\n * @param {string} str\r\n * @param {number} radix [10 || 16] default: 10\r\n * @returns {string} NRC string\r\n */\r\nfunction ncrEncode(str, radix = 10){...}\r\n/**\r\n * decode ncr in dfm\r\n * @param {string} str\r\n * @return {string}\r\n */\r\nfunction dfmDecode(str) {...}\r\n```\r\n\r\n## ChangeLog\r\n\r\n### v1.1.0\r\n\r\n1. add tests.\r\n2. new API `ncrEncode` convert string to NCR string.\r\n3. inline CLI support, use `ncrd --inline '#23435#20307'`. **Don't forget the quotes!**\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimoer96%2Fncr-decode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimoer96%2Fncr-decode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimoer96%2Fncr-decode/lists"}