https://github.com/gzu-liyujiang/cjkcharsetdetector
【可以试试该替代方案:IBM ICU】jchardet wrapper,文本编码自动检测。中日韩文本文件字符集自动检测 Auto-detection of charset in Chinese, Japanese and Korean text files。
https://github.com/gzu-liyujiang/cjkcharsetdetector
auto-detection charset encoding jchardet
Last synced: 8 months ago
JSON representation
【可以试试该替代方案:IBM ICU】jchardet wrapper,文本编码自动检测。中日韩文本文件字符集自动检测 Auto-detection of charset in Chinese, Japanese and Korean text files。
- Host: GitHub
- URL: https://github.com/gzu-liyujiang/cjkcharsetdetector
- Owner: gzu-liyujiang
- License: apache-2.0
- Created: 2020-08-05T15:36:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-25T01:36:35.000Z (about 5 years ago)
- Last Synced: 2025-01-10T21:11:29.647Z (9 months ago)
- Topics: auto-detection, charset, encoding, jchardet
- Language: Java
- Homepage:
- Size: 216 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 安卓项目工程模板


[](https://jitpack.io/#gzu-liyujiang/CJKCharsetDetector)中日韩文本文件字符集自动检测。Auto-detection of charset in Chinese, Japanese and Korean text files.
基于 Mozilla 的 [jchardet-1.1](http://jchardet.sourceforge.net) 进行易用性封装, 并打包发布到 [](https://jitpack.io/#gzu-liyujiang/CJKCharsetDetector)
```groovy
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}dependencies {
implementation 'com.github.gzu-liyujiang:CJKCharsetDetector:latest.version'
}
```
```groovy
//Charset charset = CJKCharsetDetector.detect(new FileInputStream(file));
Charset charset = CJKCharsetDetector.detect(new ByteArrayInputStream(bytes));
String str = new String(bytes, charset.name());
if (CJKCharsetDetector.inWrongEncoding(str)) {
System.err.println("File was loaded using wrong encoding: " + charset.name());
}
```
## License```text
Copyright (c) 2019-2020 gzu-liyujiang <1032694760@qq.com>Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
**NOTE**: This software include `jchardet` is licensed under the [MPL 1.1](http://www.mozilla.org/MPL/)