7

i am using the cluetip plugin and the simple use case is to to put the content in a title attribute, like below:

<a title='Top title|detail content'>Text</a>

i am now running into issues where the string that is inside "detail content' has an apostrophe inside of it and it seems to confuse cluetip plugin. Is there anyway to escape or encode an apostrophe to allow cluetip to work properly.

1
  • 2
    In .net 4.0 System.Web.HttpUtility.HtmlEncode works, but in 3.5 for some reason it skips single apostrophes. You can use System.Security.SecurityElement.Escape if you're in 3.5. Oct 14, 2011 at 19:14

3 Answers 3

11

You're looking for &apos;.
See HTML entities.

4
  • is there an method in the .net 3.5 library to take a string and convert all of these characters like apostrophe and convert them to their equivalent (&apos; in this case)
    – leora
    May 23, 2011 at 3:30
  • 5
    htmlEncode method doesn't seem to do anything to apostrophes.
    – leora
    May 23, 2011 at 3:58
  • @ooo: Sorry; HtmlAttributeEncode. (But you also need to use double-quoted attributes)
    – SLaks
    May 23, 2011 at 13:05
  • reasons for using System.Security.SecurityElement.Escape given @ stackoverflow.com/a/1934252/41153 Apr 22, 2013 at 18:41
3

You'll want to use &#39; per this link since &apos; has flaky browser support. See this old post for more info.

1
  • &#39; is single quote. &#8217; is apostrophe.
    – xr280xr
    Jan 22, 2013 at 23:14
0

have you tried HTML escaping the apostrophe?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.