encoding - 特殊字符编码
问题描述
我的项目设置基于从 CLI 生成的 Angular,我在显示本地德语字符时遇到了问题。
我meta
的index.html
:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
我的编辑器 VS Code 设置为将文件保存在UTF-8
:
"[html]": {
"editor.detectIndentation": true,
"editor.insertSpaces": false,
"files.encoding": "utf8",
},
"[typescript]": {
"files.encoding": "utf8",
},
"files.encoding": "utf8",
我的文档请求标头:
GET /home?schedule=2 HTTP/1.1
Host: localhost:4200
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://localhost:4200/home?schedule=2
Accept-Encoding: gzip, deflate, br
Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: utilityType=HEAT
以及相应的响应标头:
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 898
ETag: W/"382-xsHtQLNHNB+FVVszGe2IsoXNXEI"
Date: Fri, 31 Aug 2018 09:05:10 GMT
Connection: keep-alive
我正在使用带有latin-extended
set 的 Google Fonts Open Sans:
<link href="https://fonts.googleapis.com/css?family=Open+Sans&subset=latin-ext" rel="stylesheet">
任何输出结果仍然如下所示:
我的想法不多了,还有什么可能会影响这个?
解决方案
好的,正如@nm 已经提到的,问题是本地化文件是由外部翻译团队生成的,它将所有文本提要保存为 ANSI,而不是 UTF-8 编码。将文件从 ANSI 转换为 UTF 已解决问题。
推荐阅读
- amazon-web-services - 在 AWS IoT Core 规则操作或 AWS Timestream 数据库表中,我们如何指定/配置措施?
- python - 如何预热 Numba 的 JIT?
- python - 如何在序列化程序/视图 Django REST 框架中合并多个模型?
- powershell - 我应该如何在控制台中为每个排序步骤输出排序结果,并且可以通过 Verbose 参数控制
- django - 多个表中的 Django 查询集
- python - 如何使用一些拆分功能在字典中提取元组数据存储
- python - 如何在 Windows 10 中使用 msiexec 安装两个 python 2.7.18 实例?
- java - Query 和 QueryMap 不适用于 Rest API
- c# - 如果我在邮递员中有文件内容,请上传文件
- angular - 基于离子(角度)中的活动选项卡显示标题标题