修复双编码UTF-8文件

修复双编码UTF-8文件,utf-8,character-encoding,Utf 8,Character Encoding,我有一个双重编码的UTF-8文件。例如 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" cont

我有一个双重编码的UTF-8文件。例如

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>

<body>
<p>this is a “testâ€Â</p>
</body>
</html>
但我明白了:

iconv: illegal input sequence at position 294

有什么想法吗?

试试
Windows-1252
而不是
ISO-8859-1

这就是Windows Latin-1和Latin-1之间的区别。所有浏览器,包括Mac和Linux,都错误地接受Windows-Latin-1作为ISO-8859-1,因为它填充了0x80-0x9F字符


但不能保证所有问题都已解决。

尝试
Windows-1252
而不是
ISO-8859-1

这就是Windows Latin-1和Latin-1之间的区别。所有浏览器,包括Mac和Linux,都错误地接受Windows-Latin-1作为ISO-8859-1,因为它填充了0x80-0x9F字符


但不能保证所有问题都得到解决。

@dan04没错,这只是;HTML5提到-;)。顺便说一下,文本中使用的引号在0x80-0x9F范围内。@dan04对,它只是;HTML5提到-;)。顺便说一下,文本中使用的引号在0x80-0x9F范围内。
iconv: illegal input sequence at position 294