[html] HTML code for an apostrophe

Seemingly simple, but I cannot find anything relevant on the web.

What is the correct HTML code for an apostrophe? Is it ’?

This question is related to html ascii

The answer is


Use ' for a straight apostrophe. This tends to be more readable than the numeric ' (if others are ever likely to read the HTML directly).

Edit: msanders points out that ' isn't valid HTML4, which I didn't know, so follow most other answers and use '.


You can try ' as seen in http://unicodinator.com/#0027


' in decimal.

%27 in hex.


You can try ' as seen in http://unicodinator.com/#0027


Here is a great reference for HTML Ascii codes:

http://www.ascii.cl/htmlcodes.htm

The code you are looking for is: '


' in decimal.

%27 in hex.


A List Apart has a nice reference on characters and typography in HTML. According to that article, the correct HTML entity for the apostrophe is ’. Example use: ’ .


Depends on which apostrophe you are talking about: there’s ', ‘, ’ and probably numerous other ones, depending on the context and the language you’re intending to write. And with a declared character encoding of e.g. UTF-8 you can also write them directly into your HTML: ', , .


It's '.

As noted by msanders, this is actually XML and XHTML but not defined in HTML4, so I guess use the ' in that case. I stand corrected.


As far as I know it is ' but it seems yours works as well

See http://w3schools.com/tags/ref_ascii.asp


' in decimal.

%27 in hex.


Firstly, it would appear that ' should be avoided - The curse of '

Secondly, if there is ever any chance that you're going to generate markup to be returned via AJAX calls, you should avoid the entity names (As not all of the HTML entities are valid in XML) and use the &#XXXX; syntax instead.

Failure to do so may result in the markup being considered as invalid XML.

The entity that is most likely to be affected by this is  , which should be replaced by  


Although the ' entity may be supported in HTML5, it looks like a typewriter apostrophe. It looks nothing like a real curly apostrophe—which looks identical to an ending quotation mark: .

Just look when I write them after each other:

1: right single quotation mark entity, 2: apostrophe entity: '.

I tried to find a proper entity or alt command specifically for a normal looking apostrophe (which again, looks ‘identical’ to a closing right single quotation mark), but I haven’t found one. I always need to insert a right single quotation mark in order to get the visually correct apostrophe.

If you use just (ALT + 0146) or autoformat typewriter apostrophes and quotation marks as curly in a word processor like Word 2013, do use <meta charset="UTF-8">.


As far as I know it is &#39; but it seems yours works as well

See http://w3schools.com/tags/ref_ascii.asp


It's &apos;.

As noted by msanders, this is actually XML and XHTML but not defined in HTML4, so I guess use the &#39; in that case. I stand corrected.


Note that &apos; IS defined in HTML5, so for modern websites, I would advise using &apos; as it is much more readable than &#39;

Check: http://www.w3.org/TR/html5/syntax.html#named-character-references


Use &apos; for a straight apostrophe. This tends to be more readable than the numeric &#39; (if others are ever likely to read the HTML directly).

Edit: msanders points out that &apos; isn't valid HTML4, which I didn't know, so follow most other answers and use &#39;.


&#39; in decimal.

%27 in hex.


Here is a great reference for HTML Ascii codes:

http://www.ascii.cl/htmlcodes.htm

The code you are looking for is: &#39;


Depends on which apostrophe you are talking about: there’s &apos;, &lsquo;, &rsquo; and probably numerous other ones, depending on the context and the language you’re intending to write. And with a declared character encoding of e.g. UTF-8 you can also write them directly into your HTML: ', , .


A List Apart has a nice reference on characters and typography in HTML. According to that article, the correct HTML entity for the apostrophe is &#8217;. Example use: ’ .


Use &apos; for a straight apostrophe. This tends to be more readable than the numeric &#39; (if others are ever likely to read the HTML directly).

Edit: msanders points out that &apos; isn't valid HTML4, which I didn't know, so follow most other answers and use &#39;.


Firstly, it would appear that &apos; should be avoided - The curse of &apos;

Secondly, if there is ever any chance that you're going to generate markup to be returned via AJAX calls, you should avoid the entity names (As not all of the HTML entities are valid in XML) and use the &#XXXX; syntax instead.

Failure to do so may result in the markup being considered as invalid XML.

The entity that is most likely to be affected by this is &nbsp;, which should be replaced by &#160;


Just a one more link with nicely maintained collection Html Entities


Even though &apos; reads nicer than &#39; and it's a shame not to use it, as a fail-safe, use &#39;.

&apos; is a valid HTML 5 entity, however it is not a valid HTML 4 entity.

Unless <!DOCTYPE html> is at the top of your HTML document, use &#39;


Depends on which apostrophe you are talking about: there’s &apos;, &lsquo;, &rsquo; and probably numerous other ones, depending on the context and the language you’re intending to write. And with a declared character encoding of e.g. UTF-8 you can also write them directly into your HTML: ', , .


As far as I know it is &#39; but it seems yours works as well

See http://w3schools.com/tags/ref_ascii.asp


A standard-compliant, easy-to-remember set of html quotes, starting with the right single-quote which is normally used as an apostrophe:

  • right single-quote — &rsquo; — ’
  • left single-quote — &lsquo; — ‘
  • right double-quote — &rdquo; — ”
  • left double-quote — &ldquo; — “

Note that &apos; IS defined in HTML5, so for modern websites, I would advise using &apos; as it is much more readable than &#39;

Check: http://www.w3.org/TR/html5/syntax.html#named-character-references


Here is a great reference for HTML Ascii codes:

http://www.ascii.cl/htmlcodes.htm

The code you are looking for is: &#39;


I've found FileFormat.info's Unicode Character Search to be most helpful in finding exact character codes.

Entering simply ' (the character to the left of the return key on my US Mac keyboard) into their search yields several results of various curls and languages.

I would presume the original question was asking for the typographically correct U+02BC ', rather than the typewriter fascimile U+0027 '.

The W3C recommends hex codes for HTML entities (see below). For U+02BC that would be &#x2bc;, rather than &#x27; for U+0027.

http://www.w3.org/International/questions/qa-escapes

Using character escapes in markup and CSS

Hex vs. decimal. Typically when the Unicode Standard refers to or lists characters it does so using a hexadecimal value. … Given the prevalence of this convention, it is often useful, though not required, to use hexadecimal numeric values in escapes rather than decimal values…

http://www.w3.org/TR/html4/charset.html

5 HTML Document Representation5.4 Undisplayable characters

…If missing characters are presented using their numeric representation, use the hexadecimal (not decimal) form, since this is the form used in character set standards.


A List Apart has a nice reference on characters and typography in HTML. According to that article, the correct HTML entity for the apostrophe is &#8217;. Example use: ’ .


Firstly, it would appear that &apos; should be avoided - The curse of &apos;

Secondly, if there is ever any chance that you're going to generate markup to be returned via AJAX calls, you should avoid the entity names (As not all of the HTML entities are valid in XML) and use the &#XXXX; syntax instead.

Failure to do so may result in the markup being considered as invalid XML.

The entity that is most likely to be affected by this is &nbsp;, which should be replaced by &#160;


As far as I know it is &#39; but it seems yours works as well

See http://w3schools.com/tags/ref_ascii.asp


Use &apos; for a straight apostrophe. This tends to be more readable than the numeric &#39; (if others are ever likely to read the HTML directly).

Edit: msanders points out that &apos; isn't valid HTML4, which I didn't know, so follow most other answers and use &#39;.


Sorry if this offends anyone, but there is a reasonable article on Ted Clancy's blog that argues against the Unicode committee's recommendation to use &#8217; (RIGHT SINGLE QUOTATION MARK) and proposes using U+02BC (MODIFIER LETTER APOSTROPHE) (aka &#700; or &#x2bc;) instead.

In a nutshell, the article argues that:

  • A punctuation mark (such as a quotation mark) normally separates words and phrases, while the sides of a contraction really can't be separated and still make sense.
  • Using a modifier allows one to select a contraction with the regular expression \w+
  • It's easier to parse quotes embedded in text if there aren't quotation marks also appearing in contractions

I've found FileFormat.info's Unicode Character Search to be most helpful in finding exact character codes.

Entering simply ' (the character to the left of the return key on my US Mac keyboard) into their search yields several results of various curls and languages.

I would presume the original question was asking for the typographically correct U+02BC ', rather than the typewriter fascimile U+0027 '.

The W3C recommends hex codes for HTML entities (see below). For U+02BC that would be &#x2bc;, rather than &#x27; for U+0027.

http://www.w3.org/International/questions/qa-escapes

Using character escapes in markup and CSS

Hex vs. decimal. Typically when the Unicode Standard refers to or lists characters it does so using a hexadecimal value. … Given the prevalence of this convention, it is often useful, though not required, to use hexadecimal numeric values in escapes rather than decimal values…

http://www.w3.org/TR/html4/charset.html

5 HTML Document Representation5.4 Undisplayable characters

…If missing characters are presented using their numeric representation, use the hexadecimal (not decimal) form, since this is the form used in character set standards.


A standard-compliant, easy-to-remember set of html quotes, starting with the right single-quote which is normally used as an apostrophe:

  • right single-quote — &rsquo; — ’
  • left single-quote — &lsquo; — ‘
  • right double-quote — &rdquo; — ”
  • left double-quote — &ldquo; — “

Although the &apos; entity may be supported in HTML5, it looks like a typewriter apostrophe. It looks nothing like a real curly apostrophe—which looks identical to an ending quotation mark: .

Just look when I write them after each other:

1: right single quotation mark entity, 2: apostrophe entity: '.

I tried to find a proper entity or alt command specifically for a normal looking apostrophe (which again, looks ‘identical’ to a closing right single quotation mark), but I haven’t found one. I always need to insert a right single quotation mark in order to get the visually correct apostrophe.

If you use just (ALT + 0146) or autoformat typewriter apostrophes and quotation marks as curly in a word processor like Word 2013, do use <meta charset="UTF-8">.


Even though &apos; reads nicer than &#39; and it's a shame not to use it, as a fail-safe, use &#39;.

&apos; is a valid HTML 5 entity, however it is not a valid HTML 4 entity.

Unless <!DOCTYPE html> is at the top of your HTML document, use &#39;


Here is a great reference for HTML Ascii codes:

http://www.ascii.cl/htmlcodes.htm

The code you are looking for is: &#39;


It's &apos;.

As noted by msanders, this is actually XML and XHTML but not defined in HTML4, so I guess use the &#39; in that case. I stand corrected.


Sorry if this offends anyone, but there is a reasonable article on Ted Clancy's blog that argues against the Unicode committee's recommendation to use &#8217; (RIGHT SINGLE QUOTATION MARK) and proposes using U+02BC (MODIFIER LETTER APOSTROPHE) (aka &#700; or &#x2bc;) instead.

In a nutshell, the article argues that:

  • A punctuation mark (such as a quotation mark) normally separates words and phrases, while the sides of a contraction really can't be separated and still make sense.
  • Using a modifier allows one to select a contraction with the regular expression \w+
  • It's easier to parse quotes embedded in text if there aren't quotation marks also appearing in contractions

Firstly, it would appear that &apos; should be avoided - The curse of &apos;

Secondly, if there is ever any chance that you're going to generate markup to be returned via AJAX calls, you should avoid the entity names (As not all of the HTML entities are valid in XML) and use the &#XXXX; syntax instead.

Failure to do so may result in the markup being considered as invalid XML.

The entity that is most likely to be affected by this is &nbsp;, which should be replaced by &#160;


Just a one more link with nicely maintained collection Html Entities


A List Apart has a nice reference on characters and typography in HTML. According to that article, the correct HTML entity for the apostrophe is &#8217;. Example use: ’ .


Depends on which apostrophe you are talking about: there’s &apos;, &lsquo;, &rsquo; and probably numerous other ones, depending on the context and the language you’re intending to write. And with a declared character encoding of e.g. UTF-8 you can also write them directly into your HTML: ', , .