回显和 UTF-8 (PHP)
我已经在我的服务器上安装了 Apache(我没有使用 Apache)并且特殊字符开始显示错误。
所以我将每个文件都更改为 UTF-8,将 MySQL 配置为使用 UTF-8,一切正常。但是,我的 Python 应用程序(从网站检索一些信息)无法正常工作。
例如,我有一个文件“test.php”,它返回 0 或 1。然后 Python 代码对该结果执行任何操作。
但现在,我的Python应用程序没有收到“0”,我不知道它从网站上得到了什么。我让应用程序向我的网站发送一个 GET 请求,其中包含它所获取的内容,它向我发送了以下内容:“???0”。
我能做些什么?我尝试更改标头以将结果作为 ISO-8859-1 发送(就像以前一样),但也不起作用。
I have installed Apache on my server (I wasn't using Apache) and special characters started to show wrong.
So I changed every file to UTF-8, configured MySQL to work with UTF-8 and everything worked fine. However, my Python app (which retrieves some information from the website) doesn't work properly.
For example, I had a file "test.php" which returned either 0 or 1. Python code then did whatever with that result.
But now, my Python app doesn't receive "0", I don't know what it gets from the website. I made the app send a GET request to my site with what it was getting and it sent me this: "???0".
What can I do? I tried to change the header to send the result as ISO-8859-1 (as it was before) but isn't working either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它是 BOM 符号。在 Notepad++ 编辑器中从脚本中删除此符号(菜单 -> 编码 -> 以 UTF-8 编码无物料清单)。
It's BOM symbol. Remove this symbol from script in Notepad++ editor (Menu -> Encoding -> Encode in UTF-8 without BOM).