- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试读取一个文件,但我无法弄清楚字符编码。文件中有两个字符我知道其值,我在十六进制编辑器中看到的十六进制值如下:
0xCCA9 é
0xCCBB ê
0xCCC1 á
知道这是什么编码吗?
文件中的所有英文字符均采用 ASCII 编码。我有类似的文件,如果有任何用处,这些文件是在 mac central europe 中编码的,也许它们被意外编码了不止一次。
编辑:
在 Python 2.7 中查找映射的代码:(参见上面 Esailija 的回答)。
find_mappings(...)
是一个生成器,它被赋予一个字符映射字典。它遍历所有可用的字符集并生成符合条件的字符集。
import pkgutil
import encodings
def get_encodings():
false_positives = set(["aliases"])
found = set(name for imp, name, ispkg in pkgutil.iter_modules(encodings.__path__) if not ispkg)
found.difference_update(false_positives)
return found
def find_mappings(maps):
encodings = sorted(get_encodings())
for f in encodings:
for g in encodings:
try:
if all([k.decode(f).encode(g) == v for k,v in maps.items()]):
yield (f,g)
except:
# Couldn't encode/decode
pass
for mapping in find_mappings({'\xCC': '\xC3', '\xBB': '\xAA', '\xA9': '\xA9', '\xC1': '\xA1'}):
print(mapping)
最佳答案
它不是任何编码,而是困惑的编码转换的结果。在 UTF-8 中会怎样:
0xC3A9 é
0xC3AA ê
0xC3A1 á
所以我认为最初发生的是 UTF-8 数据在 ASCII 兼容代码页 X 中处理,然后结果被编码到 Mac Central Europe 中的文件。
要获取原始数据,您需要在 Mac Central Europe 中解释文件,在代码页 X 中重新编码结果,并在 UTF-8 中解释重新编码的结果。
我不知道代码页 X 是什么,但它必须具有以下属性,前提是上述内容是正确的:
©
编码为0xA9
;与 Mac、Windows 和 ISO 编码相同Ő
编码为0xC3
;排除任何 DOS 代码页Ľ
编码为 0xAA
Ń
编码为0xA1
关于encoding - 什么字符编码的 e 重音符号为 0xCCA9?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14128729/
我正在寻找一种方法来支持不区分大小写 + 重音不区分搜索的良好性能。到目前为止,我们在使用 MSSql 服务器时没有遇到任何问题,在 Oracle 上我们必须使用 OracleText,而现在我们在
这个问题已经有答案了: Trouble with UTF-8 characters; what I see is not what I stored (5 个回答) 已关闭 5 年前。 我刚刚将一个我
我正在寻找一种在 Linux 中使用反引号 (`)/波形符 (~) 键和其他一些键创建键盘快捷键的方法。在理想情况下: 按下波形符没有任何作用 按下波形符的同时按另一个键会触发(可自定义的)快捷方式
我有一个由术语组成的数组,其中一些包含重音字符。我像这样做一个 preg grep $data= array('Napoléon','Café'); $result = preg_grep('~' .
我使用 TextBox 在 DataGridView 中进行过滤 image .这是完美的工作。表格的单元格包含 1250 个拉丁字符。我想搜索忽略单元格中单词的重音。例子。如果是文本框 "knjaz
我在 Vim 中遇到一个奇怪的映射问题。我使用的是 Azerty 键盘。 在我的 .vimrc 中,我有以下命令可以在段落之间快速移动。 nnoremap _ { vnoremap _ { nnore
我尝试读取一个utf8编码的vcf文件,结果是: { "name": "=4A=61=76=69=65=72=20=4C=75=6A=C3=A1=6E", "tel":
我的数据库中有两个表,info 和 comment,它们的结构如下: info (id(int(10)), name(varchar(80)), ...19 other columns.., phon
我使用 QtWebkit 制作了一个应用程序。在同一个 html 页面中,在 Windows 上使用重音符号(西类牙语)时可以正常工作,但在 Linux (Ubuntu) 上则不起作用。 我不明白为什
我有(例如)两个字符串: $a = "joao"; $b = "joão"; if ( strtoupper($a) == strtoupper($b)) { echo $b; } 我希望它是
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: invalid multibyte char (US-ASCII) with Rails and Ruby
我重写 URL 以包含用户生成的旅游博客的标题。 我这样做是为了 URL 的可读性和 SEO 目的。 http://www.example.com/gallery/280-Gorges_du_Tod
我最近安装了新的 Windows 10 build 14393,我想使用新的 linux 子系统。所以我决定学习 ncurses,但我找不到如何从 getch 中获取带有重音符的字符的 UTF-8 代
我是一名优秀的程序员,十分优秀!