How to make the website show signs like “č” and “ć”?

自古美人都是妖i 提交于 2019-12-06 06:02:31

http://webdesign.maratz.com/lab/utf_table/

Use HTML entities, for example

  • č : č
  • ž : ž

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 or sans-serif) will probably have even better results, as the OS/browser would decide on the best font to use.

In short, be consistent about your character encoding throughout.

  1. Configure your editor to save in the encoding you want
  2. If you use any server side programming, make sure it isn't transcoding your data
  3. If you use a database, make sure it is configured to use the same encoding
  4. Configure your server to emit a Content-Type header that specifies that encoding
  5. Use the meta tag in your question

The W3C provides useful material on encodings that starts here.

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:

<span style="font-family:Arial Unicode MS">
    č ć ž đ š
</span>

You should be able to see your characters correctly.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!