A flutter package to convert gbk to utf-8
Branch: master
Clone or download
JZoom
Latest commit 9943756 Jun 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea update readme Jun 13, 2018
example format code Jun 13, 2018
lib format code Jun 13, 2018
test format code Jun 13, 2018
.gitignore init Jun 13, 2018
CHANGELOG.md init Jun 13, 2018
LICENSE Initial commit Jun 13, 2018
README.md update readme Jun 13, 2018
gbk2utf8.iml init Jun 13, 2018
pubspec.lock init Jun 13, 2018
pubspec.yaml init Jun 13, 2018

README.md

gbk2utf8

A flutter package to convert gbk to utf-8

目的

现在这个版本官方的http还不能支持中文gbk的解析,这个项目就是为了解决这个问题

使用方法

增加依赖


gbk2utf8: ^0.0.1

编写代码


  Future fetch(String url) async {
    http.Response response = await http.get(url);
    String str = decodeGbk ( response.bodyBytes );
    return str;
  }
  
  @override
    void initState() {
  
      fetch("http://www.ysts8.com/index_hot.html").then( (data){
        setState(() {
          _text = data;
        });
      }).catchError((e){
        _text = "网络异常,请检查";
      });
  
      super.initState();
    }



完整代码在

这里

效果: