charset_codec 0.1.1 copy "charset_codec: ^0.1.1" to clipboard
charset_codec: ^0.1.1 copied to clipboard

Cross-platform character encoding codecs aligned with CPython.

example/charset_codec_example.dart

// SPDX-FileCopyrightText: 2026 沉默の金 <cmzj@cmzj.org>
// SPDX-License-Identifier: MIT

import 'package:charset_codec/charset_codec.dart';

void main() {
  final String decoded = decodeBytes(const <int>[
    0xE4,
    0xB8,
    0xAD,
  ], encoding: 'utf-8');
  print(decoded);

  final List<int> encoded = encodeString('A中B', encoding: 'gb18030');
  print(encoded);

  final IncrementalDecoder decoder = codec('gb18030').newDecoder();
  final String first = decoder.feed(const <int>[0xD6]);
  final String second = decoder.feed(const <int>[0xD0]);
  final String last = decoder.close();
  print('$first$second$last');
}
0
likes
160
points
298
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Cross-platform character encoding codecs aligned with CPython.

Repository (GitHub)
View/report issues

Topics

#character-encoding #codec #text #native-assets #ffi

License

MIT (license)

Dependencies

code_assets, crypto, ffi, hooks, native_toolchain_rust

More

Packages that depend on charset_codec