W3C home > Mailing lists > Public > public-webapps-github@w3.org > August 2015

[fetch] Error Handle Chinese character for Charset=UTF-8 (#102)

From: Cam Song <notifications@github.com>
Date: Tue, 04 Aug 2015 19:51:40 -0700
To: whatwg/fetch <fetch@noreply.github.com>
Message-ID: <whatwg/fetch/issues/102@github.com>
I'm using Chrome(45.0.2454.15 beta (64-bit)) and Firefox(33.1.1) on Mac OS X 10.10.4. Both is supposed `fetch`.
I got messy code when the server response text has Chinese.

This is steps you can reproduce:
1. open http://xueqiu.com/
2. Open devtool console and type: 

```
var url = 'http://xueqiu.com/imgroups/search.json?q=%E5%A4%A7%E5%8A%9B&count=3&sg=1';
fetch(url, { method: 'get', credentials: 'include' }).then(function (res) {
  return res.json();
}).then(function (json) {
  return console.log('receive: ' + JSON.stringify(json));
});
```
Here is the response headers
![image](https://cloud.githubusercontent.com/assets/948896/9077282/f432b638-3b5e-11e5-8228-677cf10a83ce.png)

![image](https://cloud.githubusercontent.com/assets/948896/9077286/065d822a-3b5f-11e5-9877-7b45b3775c3b.png)


response I got **大力**  which should be **大力**。This should not be an issue of server response, since it works when using `XMLHTTPRequest`.


---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/102
Received on Wednesday, 5 August 2015 02:52:13 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 12:25:49 UTC