Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

E with accent doesn't show correctly [closed]

On my page, the text in the top middle (« Ce site Internet. ») contains E with accents which on my computer appear as question marks.

This is despite the fact that I have meta charset="UTF-8" in my head tag and the PHP file containing the text appears as UTF-8 when opened with Notepad++.

What's going on then?

like image 939
drake035 Avatar asked Oct 18 '12 10:10

drake035


People also ask

How do you fix accents on a keyboard?

Insert Accented Letters with Keyboard Shortcuts You'll use the Ctrl or Shift key along with the accent key on your keyboard, followed by a quick press of the letter. For example, to get the á character, you'd press Ctrl+' (apostrophe), release those keys, and then quickly press the A key.

How do you fix accents in Excel?

Open Microsoft Excel. Select the Insert tab on the Ribbon or click Insert in the menu bar. On the Insert tab or the Insert drop-down, select the Symbol option. Select the desired accented character or symbol from the list of symbols.

Can UTF-8 handle special characters?

Since ASCII bytes do not occur when encoding non-ASCII code points into UTF-8, UTF-8 is safe to use within most programming and document languages that interpret certain ASCII characters in a special way, such as / (slash) in filenames, \ (backslash) in escape sequences, and % in printf.

Is a UTF-8 character?

UTF-8 (UCS Transformation Format 8) is the World Wide Web's most common character encoding. Each character is represented by one to four bytes. UTF-8 is backward-compatible with ASCII and can represent any standard Unicode character.


1 Answers

The browser displays these when it can’t make sense of the numbers it is reading. UTF-8 is self-synchronzising. Unlike other multi-byte character encodings, you always know where you are with UTF-8. If you see a number 192-247, you know you are at the beginning of a multi-byte sequence. If you see 128-191 you know you are in the middle of one. There’s no danger of missing the first number and garbling the rest of the text. This means that in UTF-8, the sequence 191 followed by 224 will never occur naturally, so the browser doesn’t know what to do with it and displays �� instead.

Use the following in your head tag:

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

See: http://coding.smashingmagazine.com/2012/06/06/all-about-unicode-utf8-character-sets/

like image 113
twodayslate Avatar answered Oct 22 '22 16:10

twodayslate