HTML 页面标题中的西班牙语字符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14936291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:40:43  来源:igfitidea点击:

Spanish Characters in HTML Page Title

htmlutf-8

提问by user580950

My HTML code for Page title looks like this

我的页面标题的 HTML 代码如下所示

<title>Telefonía</title>

When i check it on browser the SPanish character is not displayed exactly like the above

当我在浏览器上检查它时,西班牙语字符与上面的显示不完全一样

It shows page title as below

它显示页面标题如下

enter image description here

在此处输入图片说明

I tried using & iacute;AND **&# 237; ** but it doesnt work in PAGE TITLE

我尝试使用& iacute; 和** 237; ** 但它在 PAGE TITLE 中不起作用

Here is my website url http://tinyurl.com/agdsqffi checked all the special codes but it doesnt work

这是我的网站网址http://tinyurl.com/agdsqff我检查了所有特殊代码但它不起作用

采纳答案by test

Try writing

尝试写作

&iacute;

&iacute;

instead. These are HTML escape characters. Here you can find a whole list http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php

反而。这些是 HTML 转义字符。在这里你可以找到一个完整的列表http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php

回答by Vucko

This works.

这有效。

<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>Telefonía</title>
</head>

回答by Jorge Eduardo

Put this in your <head>:

把它放在你的<head>

<meta charset="UTF-8">

and if you want change your title dynamically in you .js put:

如果你想在你的 .js 中动态改变你的标题:

document.title="telefonía";

回答by Jukka K. Korpela

The element <title>Telefonía</title>works just fine, provided that the document is saved in UTF-8 encoding (which is the encoding declared in an HTTP header sent by the server – no metatag inside the document can override that).

如果<title>Telefonía</title>文档以 UTF-8 编码保存(这是在服务器发送的 HTTP 标头中声明的编码 -meta文档中没有标签可以覆盖它),该元素就可以正常工作。

You seem to be changing the content of your pagetrying various ways that cannot work, such as <title>Telefon&iacute;a</title>and <title>Telefoniacute;a</title>. If you use an entity reference, you should write <title>Telefon&iacute;a</title>. But there is no need for that: using the character as such is cleaner and simpler

您似乎正在尝试各种无效的方式更改页面内容,例如<title>Telefon&iacute;a</title><title>Telefoniacute;a</title>。如果使用实体引用,则应编写<title>Telefon&iacute;a</title>. 但没有必要:使用这样的角色更干净、更简单

回答by Niel de Vries

See http://www.ascii.cl/htmlcodes.htmto check how you should encode special characters.

请参阅http://www.ascii.cl/htmlcodes.htm以检查应如何编码特殊字符。

In this case it would be &#237;or &Iacute;

在这种情况下,它将是&#237;&Iacute;

回答by Salvatorelab

You have to check two things:

你必须检查两件事:

  1. Your file encoding. Yes, your HTML file. You have to save it as UTF-8 and then write "í" or whatever character you need.
  2. Your <meta>tag. It should look like:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  1. 您的文件编码。是的,您的 HTML 文件。您必须将其保存为 UTF-8,然后写入“í”或您需要的任何字符。
  2. 你的<meta>标签。它应该看起来像:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Un saludo!

加油!

回答by scrblnrd3

<p>Telefon&#237a</p> 

is the hex code for it. &iacute works as well http://jsfiddle.net/PDCvw/EDIT
It appears to work for me in the title. A link is http://shodor.org/~amalani/acute.htmlYou have the code

是它的十六进制代码。í 也 能正常工作http://jsfiddle.net/PDCvw/编辑
它在标题中似乎对我有用 。链接是http://shodor.org/~amalani/acute.html你有代码

<title>Telefon&amp;iacute;a</title>

but what you need is Telefon&iacutea

但你需要的是 Telefonía

Telefonía

西班牙电信