如何让网站显示“”10D;”之类的标志和“”?
我正在制作一个克罗地亚语网站,我需要使用以下符号:“č”、“ć”、“ž”、“đ”和“š”。它们当前显示为小框。
信息:
- 我使用Notepad ++。
- 我将那里的编码设置为UTF-8。
- 我将以下 HTML 行放入:
但是,它不起作用。即使 Notepad ++ 也无法使用 UTF-8 显示我的字符,所以这表明我应该使用其他东西......
I'm making a website that is in Croatian, and I need to use signs like: "č", "ć", "ž", "đ" and "š". They are currently displayed as little boxes.
Info:
- I use Notepad ++.
- I set the encoding there to UTF-8.
- I put the following line of HTML in:
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
However, it does not work. Even Notepad ++ can't display my characters using UTF-8, so that would suggest that I should probably use something else...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
http://webdesign.maratz.com/lab/utf_table/
使用 HTML 实体,例如
č
ž
http://webdesign.maratz.com/lab/utf_table/
Use HTML entities, for example
č
ž
这听起来更像是字体问题而不是字符编码问题。如果是字符编码问题,字符很可能会显示为 2+ ASCII 字符。然而,这些框通常意味着字符编码是正确的,但该特定字符在正在使用的字体中不可用(这对于较少使用的字体尤其常见)。这可以解释为什么它在网站和 Notepad++ 中表现不正确。
要解决此问题,只需在编辑器和网站中使用不同的字体即可。
注意:我推荐一种广泛使用的字体,以使其发挥最佳效果。在网站中指定通用名称(例如
serif
或sans-serif
)可能会产生更好的结果,因为操作系统/浏览器将决定使用的最佳字体。This sounds more like a font issue than a character encoding issue. If it were a character encoding issue, the characters would most likely be displayed as 2+ ASCII characters. The boxes, however, typically mean the character encoding is correct, but that specific character is not available in the font being used (which is especially common with lesser-used fonts). This would explain why it's behaving incorrectly in both the website and Notepad++.
To fix the issue, simply use a different font in your editor and website.
Note: I recommend a widely used font for the best chance of it working. Specifying a generic name in the website (e.g.
serif
orsans-serif
) will probably have even better results, as the OS/browser would decide on the best font to use.简而言之,始终保持字符编码的一致性。
W3C 提供 有关编码的有用材料在这里。
In short, be consistent about your character encoding throughout.
The W3C provides useful material on encodings that starts here.
有关特殊字符及其 ASCII 代码的有用网站:复制粘贴字符
要“输入”它们,请使用替代代码。
但是,要在您的网站中使用它们,您最好使用 HTML 代码,就像您可以在 CPC 上找到的那样
A useful site for special characters and their ASCII-codes: CopyPaste Character
To 'type' them, use the alt codes.
However, to use them in your site, you'll better use the HTML codes like you can find on CPC
作为测试,请尝试以下操作:
您应该能够正确地看到您的角色。
As a test, try this:
You should be able to see your characters correctly.
我刚刚复制并粘贴了您的问题中的一行以及您的元标记,将其放入
vi
中的纯文本文件中。它工作得很好 - 所有字符都显示良好: http://www.dusystems.com/tmp/ 1.html
如果您无法使用编辑器执行相同操作,则问题出在编辑器上,而不是字符集和编码上。
如果您使用的是 Windows,则可以使用其内置记事本来编辑 UTF-8 文件。打开记事本,输入所有特殊字符,添加元标记。执行“另存为”时,从对话框的“编码”下拉列表中选择UTF-8。另存为 Something.html 并在 IE 中打开。它100%有效。
I've just copied and pasted a line from your question along with your meta tag, placed it into a plain text file in
vi
.It works just fine - all characters are displayed fine: http://www.dusystems.com/tmp/1.html
If you can't do the same with your editor then the problem is with the editor and not character sets and encodings.
If you're on Windows you can use its built-in Notepad to edit UTF-8 files. Open Notepad, type all of your special characters, add the meta tag. When doing Save As select UTF-8 from the Encoding drop-down in the dialog. Save as something.html and open in IE. It will 100% work.