charset_normalizer_dart 0.1.0 copy "charset_normalizer_dart: ^0.1.0" to clipboard
charset_normalizer_dart: ^0.1.0 copied to clipboard

Charset detection for Dart and Flutter, ported from Python charset_normalizer.

example/charset_normalizer_dart_example.dart

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

import 'dart:convert';

import 'package:charset_normalizer_dart/charset_normalizer_dart.dart';

void main() {
  final List<int> payload = utf8.encode(
    'A clear UTF-8 example with 中文字符 for charset detection.',
  );
  final CharsetMatch? best = fromBytes(payload).best();

  if (best == null) {
    print('No text encoding detected.');
    return;
  }

  print('Encoding: ${best.encoding}');
  print('Text: $best');
}
0
likes
160
points
189
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Charset detection for Dart and Flutter, ported from Python charset_normalizer.

Repository (GitHub)
View/report issues

Topics

#charset #encoding #detection #unicode

License

MIT (license)

Dependencies

charset_codec

More

Packages that depend on charset_normalizer_dart