node接收ajax传过来的中文是乱码改如何解决
 发布于 8 年前  作者 haocaokai  3971 次预览  最后一次回复是 8 年前  来自 问答 

image.pngimage.png image.png

6 回复
vincentLiuxiang

encodeURI / decodeURI

haocaokai

@vincentLiuxiang 但是我encodeURI传过来后,数据就变成空了,还没等解码呢image.pngimage.png

YUFENGWANG

把步惊云改为聂风试试

xuyitao

$.ajax({ type: “POST”, url: url, data: data, contentType: “application/json; charset=utf-8”, dataType: “json”,

  这是我的参数试试
vincentLiuxiang

@haocaokai 你的 name 不是已经 encodeURI了吗? 你把 name=%xxxx%, %xxxx% 部分 decodeURI(%xxxx%)一下就好了,

需要这么手把手么。。。

还有把你的 乱码 字符串贴出来一下,贴图片,是没人愿意去帮你转码的。

haocaokai

@vincentLiuxiang 其实好像并不需要encode,直接在node端decode解码就行了,不知道为啥