环境:Windows 10 + nginx/1.8.0。 mysql
中的文件目录均为UTF-8编码,mysql
中所有HTML文件包含 <meta charset="utf-8" />
.
我的文件 nginx.conf 的配置文件:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
charset gbk,utf-8;
source_charset gbk,utf-8;
autoindex on;
location / {
root d:/mydoc/build/html;
index index.html index.htm;
charset gbk,utf-8;
source_charset gbk,utf-8;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
我启动我的 nginx 服务器并打开 mysql
Firefox 中的目录:
所有 CJK 字符均正确显示。现在点击第三个标题---- mysql日志.html
:
显示文件 error.log 以检查发生了什么:
2020/12/05 22:41:19 [error] 11252#11076: *8 CreateFile() "d:/mydoc/build/html/mysql/mysql日志.html" failed
(2: The system cannot find the file specified),
client: 127.0.0.1, server: localhost, request:
"GET /mysql/mysql%C8%D5%D6%BE.html HTTP/1.1", host: "127.0.0.1", referrer: "http://127.0.0.1/mysql/"
输入http://127.0.0.1/mysql/mysql日志.html
在我的 Firefox 中并单击。所有 CJK 字符均正确显示。
127.0.0.1/mysql
点击title时跳转到中日韩乱码网页如何解决?
经验证,对于相同的目录和文件,CJK 字符可以在 nginx + Linux 而不是 nginx + Windows 中正确显示。
最佳答案
在 alibabacloud guide 之后,我最好的猜测是你应该只使用 charset utf-8
并且你还应该检查所有文件名是否都是 UTF-8 格式或者转换为 UTF-8 否则(只有文件名,而不是内容) .
https://stackoverflow.com/questions/60911391/
相关文章:
reactjs - 尝试使用 React-Spring 制作动画时出现错误 "TypeError:
scala - 在同一规范文件中测试 akka-http 和 akka actor 时,如何解决冲突
qt - 如何在使用 AUTORCC 的 CMake 项目中使用 qtquick_compiler_
python - np.array 到 PIL 图像 --> Typerror : Cannot h
react-native - 我可以通过 expo 获得在 android 上工作的 webpack