【发布时间】:2015-06-09 01:13:32
【问题描述】:
我有这样的 HTML(英语和西班牙语的组合):
<p><em><span class="consolas">In </span><span class="english">English</span><span class="consolas"> and </span><span><strong>Spanish</strong></span></em><em><span class="consolas"> / En </span><span class="english">Inglés</span><span class="consolas"> y </span><span><strong>Español</strong></span></em></p>
<p class="smallfont">Translated by/Traducida por Manuel Caballero (1886)</p>
<hr/>
<section>
<h2 class="smallcaps">PART ONE--The Old Buccaneer / PARTE I--EL VIEJO FILIBUSTERO</h2>
<p class="chapter">CHAPTER/CAPÍTULO 1</p>
<h3>The Old Sea-dog at the Admiral Benbow / EL VIEJO LOBO MARIN EN LA POSADA DEL 'ALMIRANTE BENBOW'</h3>
<p>SQUIRE TRELAWNEY, Dr. Livesey, and the rest of these gentlemen having
asked me to write down the whole particulars about Treasure Island, from
the beginning to the end, keeping nothing back but the bearings of the
island, and that only because there is still treasure not yet lifted, I
take up my pen in the year of grace 17__ and go back to the time when
my father kept the Admiral Benbow inn and the brown old seaman with the
sabre cut first took up his lodging under our roof.</p>
<p class="spanish"><strong>Imposible me ha sido rehusarme á las repetidas instancias que el Caballero Trelawney, el Doctor Livesey y otros muchos señores me han
hecho para que escribiese la historia circunstanciada y completa de la
Isla del Tesoro. Voy, pues, á poner manos á la obra contándolo todo,
desde el <em>alfa</em> hasta el <em>omega</em>, sin dejarme cosa alguna en el tintero, exceptuando la determinación geográfica de la isla, y esto tan solamente
porque tengo por seguro que en ella existe todavía un tesoro no
descubierto. Tomo la pluma en el año de gracia de 17-- y retrocedo hasta
la época en que mi padre tenía aún la posada del "<em>Almirante Benbow</em>," y
hasta el día en que por primera vez llegó á alojarse en ella aquel viejo
marino de tez bronceada y curtida por los elementos, con su grande y
visible cicatriz.</strong></p>
正如你在尖叫声中看到的那样:
...西班牙重音字符被替换为默认/“我不知道那是什么”字符。它以不同的替换字符出现,但在 IE 中仍然“损坏”(尖叫声来自 Chrome)。
我必须怎么做才能让这些重音字符按它们应该/自然的方式显示?
更新
我尝试了看起来很简单的修复方法,在“head”部分添加了“<meta http-equiv="content-type" content="text/html;charset=utf-8" />”行:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Treasure Island / La Isla del Tesoro</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style>
body {
font-family:"Segoe UI", "Palatino Linotype", "Bookman Old Style", "Candara", "Calibri", "Consolas", serif;
font-size: 1.2em;
}
. . .
}</style>
</head>
...但没有区别。
更新 2
即使使用 Ctrl+F5,我仍然无法获得快速提示,但对以下内容进行全局搜索和替换(将配对中的第一个替换为第二个)效果很好:
á
á
Á
Á
é
é
É
É
í
í
Í
Í
ñ
ñ
Ñ
Ñ
ó
ó
Ó
Ó
ú
ú
Ú
Ú
ü
ü
Ü
Ü
¿
¿
¡
¡
更新 3
顺便说一句,这个的 jsfiddle 版本(重音字符从来没有问题)可以看到 here
【问题讨论】:
标签: html browser html-escape-characters