使用非ASCI字符(例如ü)获取json,Chrome会正确显示网络显示 [英] Fetch json with non ASCI characters like ü, chrome displays network displays correctly

查看:177
本文介绍了使用非ASCI字符(例如ü)获取json,Chrome会正确显示网络显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在chrome开发工具中使用本地获取。
在response.json()中,收到作业的数据,但非ASCII字符显示正确。



chrome的网络选项卡显示字符正确地在响应正文中。

我试图设置内容类型的不同标头,
UTF-8和ISO-8891-1。



怎样才能看到chrome开发工具如何正确显示字符?

>我终于解决了它,我用本地 xhttpRequest 和这个本地函数

  xhr.overrideMimeType( 应用程序/ JSON;字符集= ISO-8859-1); 

我从这里取得的:

在Javascript中显示重音字符


I am using fetch native in chrome dev tools. In the response.json() the data of the job are received but non ascii characters ate bit displays correctly.

The network tab of chrome shows the characters correctly in the response body.

I have tried to set different headers of content type, UTF-8 and ISO-8891-1.

How can.I see how dev tools of chrome displays correctly the characters?

解决方案

I finally solved it, I used native xhttpRequest and this native function

xhr.overrideMimeType("application/json;charset=iso-8859-1");

which I took from here:

Displaying accented character in Javascript

这篇关于使用非ASCI字符(例如ü)获取json,Chrome会正确显示网络显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆