utf7 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

Provides methods to encode/decode utf-7 strings or adapt the modified base64 for custom methods.

Usage #

A simple usage example:

import 'package:utf7/utf7.dart';

main() {
  // encode/decode strings
  print(Utf7.encode("ûtf-8 chäräctérs")); // +APs-tf-8 ch+AOQ-r+AOQ-ct+AOk-rs
  print(Utf7.decode("+APs-tf-8 ch+AOQ-r+AOQ-ct+AOk-rs")); // ûtf-8 chäräctérs
  // encodeAll additionally encodes characters that could be control characters
  // wherever the encoded string is used
  print(Utf7.encodeAll("A b\r\nc\$")); // A+ACA-b+AA0ACg-c+ACQ-

  // encode/decode modified base64 sequences (the part between + and -)
  print(Utf7.encodeModifiedBase64("û")); // AOQ
  print(Utf7.decodeModifiedBase64("AOQ")); // û

0.2.1 #

  • Fix #1, missing + and / from base64-alphabet regex
  • Update dev-dependencies
  • Use single quoted strings and omit type annotations of local variables

0.2.0 #

  • Encode + as +- instead of +ACs-

0.1.0 #

  • Initial version


import 'package:utf7/utf7.dart';

main() {
  String string = "Tèxt cöntäînîng ûtf-8 chäräctérs";
  String encoded = Utf7.encode(string);
  String strongEncoded = Utf7.encodeAll(string);
  print("UTF-7 representation: $encoded");
  print("UTF-7 representation: $strongEncoded");
  String decoded = Utf7.decode(encoded);
  print("UTF-16 representation: $decoded");

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  utf7: ^0.2.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:utf7/utf7.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/utf7.dart. (-1.49 points)

Analysis of lib/src/utf7.dart reported 3 hints:

line 41 col 18: Unnecessary new keyword.

line 51 col 18: Unnecessary new keyword.

line 98 col 36: Unnecessary new keyword.

Format lib/utf7.dart.

Run dartfmt to format lib/utf7.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
Dev dependencies
pedantic ^1.9.0
test ^1.9.4