<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bubble Foundry &#187; character encoding</title>
	<atom:link href="http://www.bubblefoundry.com/blog/tag/character-encoding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bubblefoundry.com</link>
	<description></description>
	<lastBuildDate>Wed, 08 Feb 2012 18:23:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.bubblefoundry.com/?pushpress=hub'/>
		<item>
		<title>HTML and XML Character Encoding Gotchas in Javascript</title>
		<link>http://www.bubblefoundry.com/blog/2009/12/html-and-xml-character-encoding-gotchas-in-javascript/</link>
		<comments>http://www.bubblefoundry.com/blog/2009/12/html-and-xml-character-encoding-gotchas-in-javascript/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 02:41:41 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[character encoding]]></category>
		<category><![CDATA[character entity references]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[UTF-8]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.bubblefoundry.com/?p=299</guid>
		<description><![CDATA[Recently I was trying to execute the following Javascript with jQuery: $("#someid").append("&#60;div&#62;...&#38;deg;C&#60;/div&#62;"); I was going crazy because it worked (a degrees symbol – ° – was shown) on one page but not another, where nothing was displayed or returned by the append method. After much frustration I stumbled on a solution and I&#8217;m sharing it [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was trying to execute the following Javascript with jQuery:<code> $("#someid").append("&lt;div&gt;...&amp;deg;C&lt;/div&gt;");</code></p>
<p>I was going crazy because it worked (a degrees symbol – ° – was shown) on one page but not another, where nothing was displayed or returned by the <code>append</code> method. After much frustration I stumbled on a solution and I&#8217;m sharing it here to hopefully save others some time.</p>
<p>I was stumped but luckily I ended up reading the <a href="http://en.wikipedia.org/wiki/Character_encodings_in_HTML">Wikipedia page on character encoding in HTML</a> and learned that XML has a <a href="http://en.wikipedia.org/wiki/Character_encodings_in_HTML#XML_character_entity_references">much smaller set of character entity references</a>. In fact, there are only five: <code>&amp;amp;</code> → &amp;, <code>&amp;lt;</code> → &lt;, <code>&amp;gt;</code> → &gt;, <code>&amp;quot;</code> → &#8220;, <code>&amp;apos;</code> → &#8216;. Makes sense, since you should be using UTF-8.</p>
<p>As it turns out, my working example was an HTML page while the non-working one was XHTML. Because of the XHTML content-type declaration the parser (I&#8217;m not sure whether in jQuery or my browser) was choking on the invalid character entity reference and failing completely. So, problem solved, though I wish the single offending entity was dropped, not the whole string!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bubblefoundry.com/blog/2009/12/html-and-xml-character-encoding-gotchas-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

