1
4

3 回答 3

3

Setting the meta tag to "charset=UTF-8" doesn't actually do anything of much use (contrary to popular wisdom).

Using your text-editor you need to save the file with UTF-8 character encoding. In windows Notepad, for example, you can find the encoding option under the "Save as" option.

于 2013-05-15T23:50:56.023 回答
3

I a program displays “€” when interpreting its data as UTF-8, then the data consists of the bytes D0 B2 E2 80 9A C2 AC. This sounds like the data is all messed up, possibly due to wrong character code conversions.

On the other hand, since you say that it is still showing this, it is possible that the meta tag has no effect, because it is overridden by an HTTP header (which can only be determined when the URL of the page is available).

You should first find out what the actual character encoding of the page is. You may need to trace back its origins for this. Then convert it UTF-8 (possibly opening it in an editor that can recognize its current encoding, then saving it as UTF-8 with BOM), provided that the server does not declare another encoding.

于 2013-05-16T04:54:12.907 回答
0

The '€' character, encoded in utf-8 is 0xE2,0x82,0xAC which is binary

E2:11100010
82:10000010
AC:10101100

Stripping off the 1110 of the startbyte, the 10 of the following bytes this becomes the following 'payload bits': 10000010101100

This is decimal 8364 and must be the unicode codepoint for the Euro character.

Somehow your viewer doesn't decode the codepoint in order to get the glyph from the font, it displays each byte of the three-byte-sequence as a single character. This means your view isn't really utf-8 aware. Set the encoding in the http-header or browser. The browser might not dig the encoding set in the meta-tag of the html-page.

于 2013-11-29T13:32:51.327 回答