gbk_bytesDecode function

String gbk_bytesDecode(
  1. List<int> input
)

Implementation

String gbk_bytesDecode(List<int> input) {
  var ret = '';
  var combined = <int>[];
  var id= 0;
  while(id<input.length) {
      var charCode = input[id];
      id ++;
      if (charCode < 0x80 || charCode > 0xff || id == input.length) {
        combined.add(charCode);
      } else {
        charCode = ((charCode)<< 8) + (input[id] & 0xff);
        id ++;
        combined.add(charCode);
      }
  }
  combined.forEach((charCode) {
    var char = _gbkCode_to_char[charCode];
    if (char != null) {
      ret += char;
    } else {
      ret += String.fromCharCode(charCode);
    }
    //print(ret);
  });
  return ret;
}