开发者

What to do with umlauts (äöü) in metatags?

开发者 https://www.devze.com 2023-01-02 09:12 出处:网络
Declaring them as &xuml; etc. didn\'t work, just writing them as they are leads to display erro开发者_StackOverflow社区rs.

Declaring them as &xuml; etc. didn't work, just writing them as they are leads to display erro开发者_StackOverflow社区rs.

What to do?


If your page is encoded as UTF-8, you should be able to use special characters directly (i.e. without converting them into their HTML entity counterparts) without problems. Note that if you declare the encoding in a content-type meta tag, you should put that tag to the very beginning of the head section.


Use an encoding which can encode the characters. I'd recommend UTF-8, which is generally the preferred solution for western languages.

Keep in mind that HTTP headers have precedence over <meta http-equiv=...>, but you should set both to ensure using the correct encoding when loading the document from non-HTTP sources (eg when saving the file locally).


You should never have to use HTML entities for those characters, since they have no special meaning in HTML. Just make sure the character encoding of the text you're outputting matches your charset header.

0

精彩评论

暂无评论...
验证码 换一张
取 消