{"id":34919085,"url":"https://github.com/cloudaper/compact_enc_det","last_synced_at":"2025-12-26T13:07:38.156Z","repository":{"id":221055376,"uuid":"752729832","full_name":"cloudaper/compact_enc_det","owner":"cloudaper","description":"Ruby bindings for Google's Compact Encoding Detection C++ library","archived":false,"fork":false,"pushed_at":"2024-08-12T14:40:55.000Z","size":34,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-30T14:35:30.872Z","etag":null,"topics":["charset","charset-detection","charset-detector","encoding","encoding-detection","encoding-detector","ruby"],"latest_commit_sha":null,"homepage":"","language":"C++","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/cloudaper.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-04T16:42:56.000Z","updated_at":"2024-11-13T01:50:13.000Z","dependencies_parsed_at":"2024-04-01T18:29:34.569Z","dependency_job_id":"4e4791a5-2994-4620-868b-b9d235ee73d1","html_url":"https://github.com/cloudaper/compact_enc_det","commit_stats":null,"previous_names":["cloudaper/compact_enc_det"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cloudaper/compact_enc_det","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudaper%2Fcompact_enc_det","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudaper%2Fcompact_enc_det/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudaper%2Fcompact_enc_det/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudaper%2Fcompact_enc_det/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudaper","download_url":"https://codeload.github.com/cloudaper/compact_enc_det/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudaper%2Fcompact_enc_det/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28055272,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["charset","charset-detection","charset-detector","encoding","encoding-detection","encoding-detector","ruby"],"created_at":"2025-12-26T13:07:37.640Z","updated_at":"2025-12-26T13:07:38.148Z","avatar_url":"https://github.com/cloudaper.png","language":"C++","readme":"# Compact Encoding Detection for Ruby\n\nRuby bindings for [Google's Compact Encoding Detection](https://github.com/google/compact_enc_det) (CED for short) C++ library\n\n\u003e [!NOTE]\n\u003e Bindings temporarily use a [fork of the C++ library](https://github.com/cloudaper/compact_enc_det_fork/commit/e4eda3204bab019564b96c522baae93ee2fffdc8), which fixes the minimum CMake version for the build to pass on modern environments.\n\n## Usage\n\nYou will need [curl](https://curl.se) and [CMake](https://cmake.org) to build the C++ native extension.\n\n\u003e  macOS\n\u003e \n\u003e You can use [Homebrew](https://brew.sh) to install it:\n\u003e \n\u003e ```console\n\u003e brew install cmake\n\u003e ```\n\nThen you can install the gem from [RubyGems.org](https://rubygems.org/gems/compact_enc_det).\n\n\u003e Either add this to your Gemfile:\n\u003e\n\u003e ```ruby\n\u003e gem 'compact_enc_det', '~\u003e 1.0'\n\u003e ```\n\u003e or run the following command to install it:\n\u003e\n\u003e ```console\n\u003e gem install compact_enc_det\n\u003e ```\n\nNow you can detect the encoding via the `CompactEncDet.detect_encoding`, which is a thin wrapper around `CompactEncDet::DetectEncoding` and `MimeEncodingName` functions from the C++ library.\n\n\u003e ```ruby\n\u003e file = File.read(\"unknown-encoding.txt\", mode: \"rb\")\n\u003e result = CompactEncDet.detect_encoding(file)\n\u003e result.encoding\n\u003e # =\u003e #\u003cEncoding:Windows-1250\u003e\n\u003e result.bytes_consumed\n\u003e # =\u003e 239\n\u003e result.is_reliable?\n\u003e # =\u003e true\n\u003e ```\n\n## Contributing\n\nAny contributions are welcome! Feel free to open an issue or a pull request.\n\n### Repository\n\nThe [google/compact_enc_det](https://github.com/google/compact_enc_det) repository is linked as a Git submodule at `ext/compact_enc_det/compact_enc_det`.\n\n\u003e You need to clone the repository with `--recurse-submodules` flag:\n\u003e \n\u003e ```console\n\u003e git clone --recurse-submodules git@github.com:cloudaper/compact_enc_det.git\n\u003e ```\n\u003e \n\u003e Or initialize and update the submodule after cloning with the following commands:\n\u003e \n\u003e ```console\n\u003e git submodule init \u0026\u0026 git submodule update\n\u003e ```\n\n### Testing\n\nTests located at `tests` use the [minitest](https://github.com/minitest/minitest) framework.\n\n\u003e Run the tests via test Rake task:\n\u003e \n\u003e ```console\n\u003e rake test\n\u003e ```\n\u003e \n\u003e The gem will be compiled to `lib/compact_enc_det/compact_enc_det.bundle` first.\n\n## License\n\nThis gem is released under [MIT license](LICENSE), while the original Google's [Compact Encoding Detection library](https://github.com/google/compact_enc_det) source code, located at `ext/compact_enc_det/compact_enc_det`, is under the [Apache-2.0](LICENSE-APACHE) license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudaper%2Fcompact_enc_det","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudaper%2Fcompact_enc_det","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudaper%2Fcompact_enc_det/lists"}