在我的站点上,我用UTF-8编码的Unicode数据发送一个位置标头,如下所示:
<?php
header("Location: http://sr.wikipedia.org/sr/Србија");
exit;
?>在Internet中,它将用户发送到:http://sr.wikipedia.org/sr/Србија。
每一个其他浏览器,它都将用户发送到http://sr.wikipedia.org/sr/Србија,这是
我正在Ubuntu框上运行Apache 2,位置标头中的URL包括站点的域名。该网站为其内容类型发送text/html; charset=utf-8。
我试过:
httpd.conf.
rawurlencode().
header("Content-Type: text/html; charset=utf-8");将AddDefaultCharset utf-8指令添加到gzip之前,AddDefaultCharset utf-8指令添加到gzip,URL通过utf8_encode()和utf8_decode()但是,也就是仍然无法识别URL的编码。有什么建议吗?
发布于 2011-02-03 09:17:03
您忘记了头字段名,需要使用rawurlencode正确地编码URI路径。
header("Location: http://sr.wikipedia.org/sr/".rawurlencode("Србија"));https://stackoverflow.com/questions/4884193
复制相似问题