ASCII大于128且低于255的AJAX [英] AJAX with ASCII above 128 and below 255

查看:143
本文介绍了ASCII大于128且低于255的AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数据库中,我保存了一些字符,如£,¥,?,?,?。


当我直接在我的HTML中显示它们时,它们很好。


但是当我使用AJAX从这里带来这个字符串时PHP并显示它,显示未知字符(�����)。其余的字符串显示正常,问题只出在这些字符上。


如何解决这个问题?

解决方案

< blockquote>嗨...


它似乎是响应的字符编码问题。我认为XMLHttpRequest总是使用UTF-8编码以及页面的编码是什么?


亲切的问候



嗨...


它似乎是响应的字符编码问题。我认为XMLHttpRequest总是使用UTF-8编码,你的页面编码是什么?


亲切的问候



它的UTF-8,就页面而言。

但我认为不应该影响ASCII 255以下的字符。



在这一行中有什么要修改的吗?

xmlHttp.setRequestHeader(" Content-type"," application / x-www-form-urlencoded");


嗯...可能你可以在服务器端将它们编码为html-entities(喜欢这个)? ...

In the Database, I save some characters like £, ¥, ?, ?, ?.

When I display them directly in my HTML, they are fine.

But when I''m using AJAX to bring this string from PHP and display it, its displaying unknown characters (� � � � �). Rest of the string is being displayed fine, the problem is only with these characters.

How can I solve this?

解决方案

hi ...

it seems to be an character encoding problem with the response. i think that the XMLHttpRequest always uses UTF-8 encoding and what is the encoding of your page?

kind regards


hi ...

it seems to be an character encoding problem with the response. i think that the XMLHttpRequest always uses UTF-8 encoding and what is the encoding of your page?

kind regards

Its UTF-8, as far as page is concerned.
But I don''t think that should effect characters below ASCII 255.


And is there anything to be amended in this line?

xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");


hmmm ... may be you could encode them at serverside as html-entities (like this)? ...


这篇关于ASCII大于128且低于255的AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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