Enough Convert 는 Dart 내장 `dart:convert` 를 확장하여 ISO 8859, Windows, DOS, GBK, Big5 및 KOI8 R/U 와 같은 추가 문자 인코딩을 지원합니다. 국제화 애플리케이션에서 흔히 사용되는 레거시 및 UTF-8 이외의 텍스트 형식 처리 시의 공백을 메웁니다. 오래된 시스템이나 지역별 인코딩에서 텍스트를 파싱하거나 생성하는 데 이상적이며, 다양한 환경에서 정확한 데이터 처리를 보장합니다.
사용 사례
비-UTF-8 인코딩을 사용하는 레거시 텍스트 파일 파싱
지역 문자 집합에서 다국어 콘텐츠 처리
데스크톱 및 모바일 앱에서 서로 다른 코드 페이지 간 변환
DOS 또는 Windows 인코딩을 사용하여 오래된 시스템에서 데이터 처리
국제화 앱에서 동아시아 텍스트(GBK, Big5) 지원
시리아 문자( KOI8-R/U)의 올바른 표시 보장
주요 기능
ISO 8859, Windows, DOS, GBK, Big5 및 KOI8 인코딩을 지원합니다
경량이며 모든 플러터 플랫폼과 호환됩니다
`dart:convert` 확장하는 간단한 API
외부 종속성 없음
레거시 형식에 대한 정확한 인코딩/디코딩
크로스 플랫폼 일관성
적합한 대상
레거시 데이터 소스와 함께 작업하는 개발자
다국어 텍스트 지원이 필요한 앱
동아시아 또는 키릴 문자 집합을 포함하는 프로젝트
코드페이지 변환을 필요로 하는 모바일 및 데스크톱 앱
비-UTF-8 콘텐츠를 처리하는 국제화 팀
고려 사항
UTF-8 전용 워크플로우에는 필요하지 않음
특정 레거시 인코딩에 제한됨
대상 인코딩 표준에 대한 지식이 필요할 수 있습니다
대규모 변환 시 성능 영향은 미미하지만 존재한다
알려진 비-UTF-8 입력/출력을 다룰 때 가장 효과적입니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Support for character encodings / charsets / codecs missing from dart:convert.
Supports the following encodings:
Latin / ISO 8859 encodings:
Latin 1 / ISO 8859-1
Latin 2 / ISO 8859-2
Latin 3 / ISO 8859-3
Latin 4 / ISO 8859-4
Latin 5 / ISO 8859-5
Latin 6 / ISO 8859-6
Latin 7 / ISO 8859-7
Latin 8 / ISO 8859-8
Latin 9 / ISO 8859-9
Latin 10 / ISO 8859-10
Latin 11 / ISO 8859-11
Latin 13 / ISO 8859-13
Latin 14 / ISO 8859-14
Latin 15 / ISO 8859-15
Latin 16 / ISO 8859-16
Windows Codepage Encodings:
Windows-1250 / cp-1250
Windows-1251 / cp-1251
Windows-1252 / cp-1252
Windows-1253 / cp-1253
Windows-1254 / cp-1254
Windows-1255 / cp-1255
Windows-1256 / cp-1256
DOS Codepage Encodings:
cp-850
GBK (compatible with GB-2312)
KOI8
KOI8-R
KOI8-U
Big5
Usage
Using enough_convert is pretty straight forward:
import'package:enough_convert/enough_convert.dart';
main() {
final codec = constWindows1252Codec(allowInvalid: false);
final input = 'Il faut être bête quand même.';
final encoded = codec.encode(input);
final decoded = codec.decode([...encoded]);
print('${codec.name}: encode "$input" to "$encoded"');
print('${codec.name}: decode $encoded to "$decoded"');
}
Installation
Add this dependency your pubspec.yaml file:
dependencies:enough_convert:^1.6.0
The latest version or enough_convert is .
Wait, what is this about?
Dylan (not associated with this project in any way) explains the world of text encoding quite well:
It's 2022, do we still need this?
Short answer: yes.
Long answer: yes, there are still many web pages, emails and other content out there that is encoded in various text encodings.
Features and bugs
Please file feature requests and bugs at the issue tracker.