flutter_charset_detector
6.0.0, released 6 months ago by madlon-kay.com
Detect and decode the character encoding of text bytes automatically.
What it does
It automatically analyzes raw text bytes of unknown character sets and decodes them into readable strings. The package relies on native Mozilla universal charset detection libraries across platforms.
AI-written summary of version 6.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read text files with unknown or mixed encodings.
- You are handling raw bytes from network requests or file inputs where the charset is not specified.
Skip it when
- You already know the exact charset of the text bytes you are trying to decode.
- You only need standard UTF-8 parsing.
Strengths
- Supports multiple platforms including Android, iOS, macOS, and Web.
- Automatically determines character sets using proven Mozilla-derived libraries.
Weaknesses
- Detection accuracy depends on the underlying native libraries and input size.
- Detectable charsets differ slightly between platforms.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Web requires TextDecoder support. Other platforms require no special setup.
import 'package:flutter_charset_detector/flutter_charset_detector.dart';
Uint8List bytes = getBytes();
DecodingResult result = CharsetDetector.autoDecode(bytes);
print(result.charset);
print(result.string);Alternatives
Packages that do the same job and could replace flutter_charset_detector.
- enough_convert
Support for character encodings and codecs missing from dart:convert.
79Compare - asn1lib
Encodes and decodes ASN.1 objects using BER byte encoding in Dart.
85Compare - csv_plus
Fast, zero-dependency CSV parser, encoder, streamer, and query engine for Dart.
82Compare - standard_message_codec
Binary codec for efficient encoding/decoding of Dart objects without a schema.
80Compare