gbk_bytesEncode function
Implementation
List<int> gbk_bytesEncode(String input) {
var ret = <int>[];
input.codeUnits.forEach( (charCode) {
var char = String.fromCharCode(charCode);
//print(char);
var gbkCode = _char_to_gbkCode[char];
//print('$char = ${gbkCode.toRadixString(16)}');
if (gbkCode != null ) {
//split to two bytes
var a =(gbkCode >> 8) & 0xff;
var b = gbkCode & 0xff;
ret.add(a);
ret.add(b);
//print(' ${gbkCode.toRadixString(16)} -- ${a.toRadixString(16)} ${b.toRadixString(16)}');
}
else {
ret.add(charCode);
}
});
return ret;
}