drll85318 2014-07-31 10:43 采纳率: 100%
浏览 76

NGINX UTF-8编码

I have a LDAP installed on Ubuntu 14.04. My webpage is UTF-8 but I have problems when retrieving data from a form. When I submit a form that contains characters like 'ñ' or 'é' and I print the $_POST var the data I submited is corrupted because of a encoding mismatch as I undersand.

I have read a lot of tutorials and I have done everything I have found. This is how looks my** nginx.conf** now:

user www-data;
worker_processes 4;
pid /run/nginx.pid;


events {
        worker_connections 768;
        # multi_accept on;
}

http {
        charset utf-8; <----    This should be the fix     --->

        .... other things

Should I modify de sites-enabled/default also? ( It doesn't change the result anyway )

This is the** headers,** from wget -S

HTTP/1.1 200 OK
  Server: nginx/1.4.6 (Ubuntu)
  Date: Thu, 31 Jul 2014 16:41:36 GMT
  Content-Type: text/html; charset=utf-8
  Transfer-Encoding: chunked
  Connection: keep-alive
  X-Powered-By: PHP/5.5.9-1ubuntu4.3

The only way around for making it work was setting accept-charset="ISO-8859-1" in the form tag, but this is not a solution because doesn't work in IE and my web is a little more than a form.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab中使用gurobi时报错
    • ¥15 WPF 大屏看板表格背景图片设置
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂