{"id":28468592,"url":"https://github.com/cnwhy/gbk.js","last_synced_at":"2025-10-27T02:14:54.680Z","repository":{"id":57245355,"uuid":"118432827","full_name":"cnwhy/GBK.js","owner":"cnwhy","description":"小而快的GBK库，支持浏览器端","archived":false,"fork":false,"pushed_at":"2019-06-26T09:02:36.000Z","size":590,"stargazers_count":116,"open_issues_count":0,"forks_count":42,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-07T08:07:59.096Z","etag":null,"topics":["gb2312","gbk"],"latest_commit_sha":null,"homepage":"https://blog.whyoop.com/GBK.js/demo","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnwhy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-22T09:08:30.000Z","updated_at":"2025-03-18T06:47:19.000Z","dependencies_parsed_at":"2022-08-31T00:01:43.008Z","dependency_job_id":null,"html_url":"https://github.com/cnwhy/GBK.js","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cnwhy/GBK.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnwhy%2FGBK.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnwhy%2FGBK.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnwhy%2FGBK.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnwhy%2FGBK.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnwhy","download_url":"https://codeload.github.com/cnwhy/GBK.js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnwhy%2FGBK.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261948763,"owners_count":23234885,"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":["gb2312","gbk"],"created_at":"2025-06-07T08:08:03.367Z","updated_at":"2025-10-27T02:14:49.636Z","avatar_url":"https://github.com/cnwhy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e 一个小而快的GBK库,支持浏览器\n\n### 说明：\n- 编码表是经过简单压缩的,最后打包出的min版只有不到30k(gzip 后20k)\n\t\u003e 正常的编码表可能要到200K以上\n- 本库不包含GBK自定义（扩展）码区\n- 实现了URI相关函数,方便使用\n- 浏览器请使用 `dist/` 路径下的文件\n- 浏览器版本加载时会解压编码表,建议异步加载\n\n[demo](https://blog.whyoop.com/GBK.js/demo)\n\n## API\n\n### GBK.encode({string}) 解码GBK为一个字节数组\n```\nGBK.encode('时顺地?abc地')\n\u003e [ 202, 177, 203, 179, 181, 216, 63, 97, 98, 99, 181, 216 ]\n```\n\n### GBK.decode({BbyteArry}) 解码GBK编码的字节数组 返回字符串\n```\nGBK.decode([ 202, 177, 203, 179, 181, 216, 63, 97, 98, 99, 181, 216 ])\n\u003e 时顺地?abc地;\n```\n\n### URI相关函数\n\n#### GBK.URI.encodeURI({String})  转换规则和 `encodeURI` 函数一至\n```\nGBK.URI.encodeURI('https://abc.com/?kk=abv\u0026bb=火车头#top')\n\u003e https://abc.com/?kk=abv\u0026bb=%BB%F0%B3%B5%CD%B7#top\n```\n#### GBK.URI.decodeURI({String})  转换规则和 `decodeURI` 函数一至\n\n#### GBK.URI.encodeURIComponent({String})  转换规则和 `encodeURIComponent` 函数一至\n```\nGBK.URI.encodeURIComponent('https://abc.com/?kk=abv\u0026bb=火车头#top')\n\u003e https%3A%2F%2Fabc.com%2F%3Fkk%3Dabv%26bb%3D%BB%F0%B3%B5%CD%B7%23top\n```\n\n#### GBK.URI.decodeURIComponent({String})  转换规则和 `decodeURIComponent` 函数一至","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnwhy%2Fgbk.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnwhy%2Fgbk.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnwhy%2Fgbk.js/lists"}