提交 e3375ebe 编写于 作者: J Jake Champion 提交者: Jake Champion

respect charset within readBlobAsText

fixes https://github.com/JakeChampion/fetch/issues/1059
上级 f7e3e920
......@@ -193,7 +193,9 @@ function readBlobAsArrayBuffer(blob) {
function readBlobAsText(blob) {
var reader = new FileReader()
var promise = fileReaderReady(reader)
reader.readAsText(blob)
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type)
var encoding = match ? match[1] : 'utf-8'
reader.readAsText(blob, encoding)
return promise
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册