{"id":16808891,"url":"https://github.com/timakin/gonvert","last_synced_at":"2025-03-22T02:31:45.304Z","repository":{"id":57487869,"uuid":"77736890","full_name":"timakin/gonvert","owner":"timakin","description":"Golang character encoding converter with an automatic code-estimation.","archived":false,"fork":false,"pushed_at":"2017-01-12T00:02:42.000Z","size":48,"stargazers_count":26,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T07:12:09.132Z","etag":null,"topics":["character","character-encoding","character-encoding-converter","converter","encoder","encoding","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/timakin.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":"2016-12-31T11:04:52.000Z","updated_at":"2023-08-02T05:48:45.000Z","dependencies_parsed_at":"2022-08-29T13:30:55.341Z","dependency_job_id":null,"html_url":"https://github.com/timakin/gonvert","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timakin%2Fgonvert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timakin%2Fgonvert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timakin%2Fgonvert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timakin%2Fgonvert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timakin","download_url":"https://codeload.github.com/timakin/gonvert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898185,"owners_count":20528331,"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":["character","character-encoding","character-encoding-converter","converter","encoder","encoding","golang"],"created_at":"2024-10-13T10:00:17.328Z","updated_at":"2025-03-22T02:31:45.034Z","avatar_url":"https://github.com/timakin.png","language":"Go","readme":"Gonvert\n====\n\nSimple character-encoding converter with an automatic character-code detection in Golang.\nYou can convert without a declaration of a previous encoding.\n\n[![Build Status](https://travis-ci.org/timakin/gonvert.svg?branch=master)](https://travis-ci.org/timakin/gonvert)\n[![Coverage Status](https://coveralls.io/repos/github/timakin/gonvert/badge.svg)](https://coveralls.io/github/timakin/gonvert)\n\n## Install\n```\ngo get github.com/timakin/gonvert\n```\n\n## Current Support\n- Shift_JIS \u003c-\u003e UTF8\n- Shift_JIS \u003c-\u003e EUC-JP\n- Shift_JIS \u003c-\u003e GBK\n- EUC-JP \u003c-\u003e UTF8\n- EUC-JP \u003c-\u003e GBK\n- GBK \u003c-\u003e UTF8\n- UTF8 \u003c-\u003e UTF16\n\nYou can specify the character code to encode/decode with gonvert constatants.\n\nPrepared `const` character-code is following.\n\n```\nconst (\n\tUTF8 CharCode = iota\n\tSJIS\n\tEUCJP\n\tGBK\n\tUTF16BE\n\tUTF16LE\n)\n```\n\n## Usage\n\nYou can call the converter with 2 or 3 arguements.\n\nIf you set 2 variables, gonvert will estimate the code automatically.\n\nBut if you already know the code of strings, you should set the third arguements, without an estimation.\n\n```\npackage main\n\nimport (\n    \"github.com/timakin/gonvert\"\n    \"fmt\"\n)\nfunc main() {\n    // ------------ Estimation case ------------\n\n    // Input a Shift_JIS encoded string\n    sjisStr := \"\\x8c\\x8e\\x93\\xfa\\x82\\xcd\\x95\\x53\\x91\\xe3\\x82\\xcc\\x89\\xdf\\x8b\" +\n               \"\\x71\\x82\\xc9\\x82\\xb5\\x82\\xc4\\x81\\x41\\x8d\\x73\\x82\\xa9\\x82\\xd3\" +\n               \"\\x94\\x4e\\x82\\xe0\\x96\\x94\\x97\\xb7\\x90\\x6c\\x96\\xe7\\x81\\x42\"\n    converter := gonvert.New(sjisStr, gonvert.UTF8)\n    result, err := converter.Convert()\n    if err != nil {\n        panic(\"Failed to convert!\")\n    }\n    // This will print out the utf-8 encoded string: \"月日は百代の過客にして、行かふ年も又旅人也。\"\n    fmt.Print(result)\n\n    // -----------------------------------------\n\n    // ------------ Specified-code case ------------\n\n    sjisStr := \"\\x8c\\x8e\\x93\\xfa\\x82\\xcd\\x95\\x53\\x91\\xe3\\x82\\xcc\\x89\\xdf\\x8b\" +\n               \"\\x71\\x82\\xc9\\x82\\xb5\\x82\\xc4\\x81\\x41\\x8d\\x73\\x82\\xa9\\x82\\xd3\" +\n               \"\\x94\\x4e\\x82\\xe0\\x96\\x94\\x97\\xb7\\x90\\x6c\\x96\\xe7\\x81\\x42\"\n\n    // Should send `before` character code if you already know, because an estimation like above may become incorrect.\n    converter := gonvert.New(sjisStr, gonvert.UTF8, gonvert.SJIS)\n    result, err := converter.Convert()\n    if err != nil {\n        panic(\"Failed to convert!\")\n    }\n    fmt.Print(result)\n\n    // -----------------------------------------\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimakin%2Fgonvert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimakin%2Fgonvert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimakin%2Fgonvert/lists"}