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

outdated

A starting point for Dart libraries or applications.

The GBK (Chinese Internal Code Specification: China GBK 汉字内码扩展规范编码表) code converter library

Created from GBK standard, generated code converter tables, overwrote converter class of dart. It's a pure dart solution.

Usage #

A simple usage example:

import 'package:gbk_codec/gbk_codec.dart';

main() {
  String gbkString = '64 61 72 74 20 47 42 4b 20 63 6f 64 65 20 83c9 b0b6 d4b3 c295 cce4 b2bb d7a1 2c 20 63 68 69 6e 65 73 65 20 73 69 6d 70 6c 65 3a c7e1 d6db d2d1 b9fd cdf2 d6d8 c9bd';
  List<int> gbkCode  =  new List<int>();
  gbkString.split(' ').forEach((s) => gbkCode.add(int.parse(s, radix:16)));
  String text = gbk.decode(gbkCode);
  print(text); //'dart GBK code 兩岸猿聲啼不住, chinese simple:轻舟已过万重山'

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

Features and bugs #

Please file feature requests and bugs at the issue tracker.

5
likes
0
pub points
91%
popularity

Publisher

unverified uploader

A starting point for Dart libraries or applications.

Homepage

License

unknown (LICENSE)

Dependencies

html

More

Packages that depend on gbk_codec