gbk_codec 0.4.0 copy "gbk_codec: ^0.4.0" to clipboard
gbk_codec: ^0.4.0 copied to clipboard

GBK codec converter (enCode and deCode) library includes bytes codec.

example/gbk_codec_example.dart

import 'dart:mirrors';

import 'package:gbk_codec/gbk_codec.dart';

main() {
  String text = 'dart GBK code 兩岸猿聲啼不住, chinese simple:轻舟已过万重山.';

  //gbk encode
  List<int> gbkCodes = gbk.encode(text);
  String hex = '';
  gbkCodes.forEach((i) {
    hex += i.toRadixString(16) + ' ';
  });
  print(hex);

  //gbk decode
  String decoded_text = gbk.decode(gbkCodes);
  print(decoded_text);

  //gbk_bytes encode
  List<int> gbk_byteCodes = gbk_bytes.encode(text);
  hex = '';
  gbk_byteCodes.forEach((i) {
    hex += i.toRadixString(16) + ' ';
  });
  print(hex);

  //gbk_bytes decode
  String decoded_bytes_text = gbk_bytes.decode(gbk_byteCodes);
  print(decoded_bytes_text);
}
5
likes
140
pub points
90%
popularity

Publisher

unverified uploader

GBK codec converter (enCode and deCode) library includes bytes codec.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

html

More

Packages that depend on gbk_codec