<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
<head>
<title>17.opml</title>
<dateCreated>Sat, 17 Nov 2007 10:15:19 GMT</dateCreated>
<dateModified>Sat, 17 Nov 2007 10:15:38 GMT</dateModified>
<ownerName>Tom Morris</ownerName>
</head>
<body>
<outline text="Character encoding hell" created="Sat, 17 Nov 2007 10:15:19 GMT"><outline text="I've found something new to loath - &lt;a href=&quot;http://php.net&quot;&gt;PHP&lt;/a&gt; character encoding issues. I use the &lt;a href=&quot;http://php.net/dom&quot;&gt;DOM functions&lt;/a&gt; in PHP to manipulate the XML that stores the data on this blog, only PHP seems incapable of doing anything even vaguely sane with the data. &lt;a href=&quot;http://uk.php.net/utf8_encode&quot;&gt;utf8_encode&lt;/a&gt; was the first thing I tried, and doesn't really help. The problem is that I occasionally copy quotes from websites that contain things like emdashes and endashes. When I post them to the server, I get all sorts of problems with character encoding - usually ending in the XML library not outputting anything and deleting whatever I'd posted that day. I would then have to load up the RSS feed, convert the data back out into plain text with HTML and repost it. What a performance. I read &lt;a href=&quot;http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss&quot;&gt;messy78's post on character encoding&lt;/a&gt;, but since I'm not using the XML parser but the DOM, that didn't seem relevant - and I looked at &lt;a href=&quot;http://www.phpwact.org/php/i18n/charsets&quot;&gt;Character Encoding Issues&lt;/a&gt;. After a bit of testing, it looks like the &lt;a href=&quot;http://php.net/iconv&quot;&gt;Iconv&lt;/a&gt; library solves the problem. Currently, I run the following:&#13;" created="Sat, 17 Nov 2007 10:15:19 GMT"/><outline text="&#13;" created="Sat, 17 Nov 2007 10:15:19 GMT"/><outline text="&lt;code&gt;htmlentities(iconv(&quot;&quot;, &quot;ISO-8859-1//TRANSLIT&quot;, &amp;#36;string))&lt;/code&gt;&#13;" created="Sat, 17 Nov 2007 10:15:19 GMT"/><outline text="&#13;" created="Sat, 17 Nov 2007 10:15:19 GMT"/><outline text="I hope this will solve the problem. But PHP hasn't exactly made it easy. It's only shown to me why all software and all formats needs to support full Unicode, now. Repeat after me: Unicode now. Of course, everybody's favourite RDF format, Notation 3, requires Unicode." created="Sat, 17 Nov 2007 10:15:19 GMT"/></outline><outline text="What have you sacrified?" created="Sat, 17 Nov 2007 10:15:38 GMT"><outline text="&lt;a href=&quot;http://www.reason.com/news/show/123496.html&quot; rev=&quot;vote-for&quot;&gt;Judge Andrew Napolitano&lt;/a&gt; interviewed at Reason: &lt;q&gt;Remember that the British government permitted its soldiers to execute self-written search warrants. They called them &quot;writs of assistance,&quot; and they were one of the last straws that caused American colonist to rebel. It's bitterly ironic that 230 years later a popularly elected government would authorize its own agents to do the same thing that when a monarchy did it, we fought a war of rebellion in reaction - which we won!&lt;/q&gt;&#13;" created="Sat, 17 Nov 2007 10:15:38 GMT"/><outline text="&#13;" created="Sat, 17 Nov 2007 10:15:38 GMT"/><outline text="&lt;q&gt;Government grows in wartime because people are afraid, and they accept the satanic bargain that government offers: Give us your liberty and we will keep you safe. Many people think that when government is suppressing speech or privacy or fair prosecutions, that since those usurpations are so drastic that they &lt;em&gt;must&lt;/em&gt; be keeping us safer.&lt;/q&gt; (Via &lt;a href=&quot;http://right-thinking.com/index.php/weblog/comments/of_by_and_for_the_sheeple/&quot;&gt;Right Thinking from the Left Coast&lt;/a&gt;, perhaps the best right wing blog out there...)&#13;" created="Sat, 17 Nov 2007 10:15:38 GMT"/><outline text="&#13;" created="Sat, 17 Nov 2007 10:15:38 GMT"/><outline text="Sacrificing liberty is just fine, though. After all, there be terrrrriiiiisssts! In fifty years, if there's any streak of liberty left in the young, they'll be asking us: &quot;What did &lt;em&gt;you&lt;/em&gt; do to protect our civil liberties?&quot; And we'll say &quot;Pretty much sweet F.A. We were all too absorbed in Paris Hilton and &lt;em&gt;I'm A Celebrity, Get Me Out Of Here&lt;/em&gt;.&quot;" created="Sat, 17 Nov 2007 10:15:38 GMT"/></outline></body>
</opml>
