Tom Morris



2007.11.17

  No. 703 

Character encoding hell 2007-11-17T10:15:19ZPermalink

I've found something new to loath - PHP character encoding issues. I use the DOM functions 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. utf8_encode 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 messy78's post on character encoding, but since I'm not using the XML parser but the DOM, that didn't seem relevant - and I looked at Character Encoding Issues. After a bit of testing, it looks like the Iconv library solves the problem. Currently, I run the following:

htmlentities(iconv("", "ISO-8859-1//TRANSLIT", $string))

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.

What have you sacrified? 2007-11-17T10:15:38ZPermalink

Judge Andrew Napolitano interviewed at Reason: Remember that the British government permitted its soldiers to execute self-written search warrants. They called them “writs of assistance,” 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!

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 must be keeping us safer. (Via Right Thinking from the Left Coast, perhaps the best right wing blog out there…)

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: “What did you do to protect our civil liberties?” And we’ll say “Pretty much sweet F.A. We were all too absorbed in Paris Hilton and I’m A Celebrity, Get Me Out Of Here.”

Comments
blog comments powered by Disqus


Tom Morris 9f4907d871750fd4c9b9bad7086701b51d6abd10 bd9f81a05283ed85e699175ed057b4a497f20b77 802c68123e12bf69d99a25a87cef360f18813fe4
Currently in: Kent, England
Usually in: East Sussex, England

I am a , an , like to code in and (and Java, but let’s not talk about that), and noodle about with and the .

I have an MA in philosophy from Heythrop College, University of London. My philosophical interests are in analytic metaphysics, ontology, modality, the work of , , , and . I have a strange, unfulfilled interest in . I’ve been influenced by Gadamer, by , , and .

Musically, I like jazz fusion, soul and P-Funk. My musical nirvana would be a mixture of Beethoven, Miles Davis and George Clinton topped with a side-serving of Erykah, Jill and Angie.

I also write for the Citizendium, an online encyclopedia project. If you know about stuff, you should join in. I occasionally produce audio recordings for The Pod Delusion.

Elsewhere:

  • GPG Key
  • del.icio.us
  • Flickr
  • Twitter
  • Jaiku
  • LinkedIn
  • ma.gnolia
  • blip.tv
  • upcoming.org
  • MetaFilter
  • LiveJournal
  • CiteULike
  • Technorati Profile

RSS Feed Subscribe:

RDF

« November 2007 »
SuMoTuWeThFrSa
 123
45678910
11121314151617
18192021222324
252627282930 

View in month context

On this day in: 2006 2008 2009