Pouya BCD
Pouya BCD

Reputation: 1031

How can I show special characters like "e" with accent acute over it in HTML page?

I need to put the name of some universities on my web page. I have typed them as they were but in some browser or maybe some computers they appear differently. For example, "Universite de Moncton" should have the 2nd "e" in Universite with an accent acute over it. Could you please help about it.

Upvotes: 14

Views: 49993

Answers (7)

iorgu
iorgu

Reputation: 3033

In case you need to display a special character, such as the é in an :after (or a :before), you have to look it up from here, and you have to omit the first 0, like so:

div:after {
  content: "\00E9";
}
<div></div>

Upvotes: 0

asthasr
asthasr

Reputation: 9417

There are two methods. One is by using "HTML entities." You need to enter them as, for example, &eacute;. Here is a comprehensive reference of named entities; you can also reference the Unicode code point of a given character, using its decimal form as &#1234; or its hex form as &#x4D2;.

Perhaps more common now (ten years after this answer was originally entered) is simply using Unicode characters directly. Rất dễ dàng, phải không? This is more acceptable and universal because most pages now use UTF-8 as their character encoding.

运气!

Upvotes: 3

Adriano Varoli Piazza
Adriano Varoli Piazza

Reputation: 7429

I think from the mention that 'in some computers or browsers they appear differently' that the problem you have is with the page or server encoding. You must

  • encode the file correctly (how to do this depends on your text editor)
  • assign the correct encoding in your webpage, done with a meta tag

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

  • force the server encoding with, for example, PHP's header() function:

    header('Content-Type: text/plain; charset=ISO-8859-1');

Or, yes, as everyone has pointed out, use the html entities for those characters, which is always safe, but might make a mess when you try to find-replace in code.

Upvotes: 4

scunliffe
scunliffe

Reputation: 63606

You can use UTF-8 HTML Entities:

&#232;    è
&#233;    é
&#234;    ê
&#235;    ë

Here's a handy search page for the UTF-8 Character Map

Upvotes: 5

Gumbo
Gumbo

Reputation: 655489

If you’re using a character set that contains that character, you can use an appropriate character encoding and use it literally:

Universit‌é de Moncton

Don’t forget to specify the character set/encoding properly.

If not, you can use an HTML character reference, either a numeric character reference that denotes the code point of the character in the Universal Character Set (UCS):

Universit‌&#233; de Moncton
Universit‌&#xE9; de Moncton

Or using an entity reference:

Universit‌&eacute; de Moncton

But this entity is just a named representation of the numeric character reference (see the list of entity references that are defined in HTML 4):

<!ENTITY eacute CDATA "&#233;" -- latin small letter e with acute,
                                  U+00E9 ISOlat1 -->

Upvotes: 28

Randy the Dev
Randy the Dev

Reputation: 26730

By typing it in to your HTML code. é <--You can copy and paste this one if you want. Microsoft windows has a character map for accessing characters not on your keyboard, it's called Character map.

Upvotes: 2

Scott
Scott

Reputation: 2193

http://www.starr.net/is/type/htmlcodes.html

This site shows you the HTML markup for all of those characters that you will need :)

Upvotes: 0

Related Questions