2007.11.17

Character encoding hell 2007-11-17T10:15:19ZTitled entry permalink

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:38ZTitled entry permalink

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.”

 

Login with your OpenID:
No. 703
Tom Morris
Currently in: East Sussex, England
Usually in: East Sussex, United Kingdom
AIM: tommorris
YIM: tom.morris

I am a , an , like to code in and noodle about with and the . I also have a BA in philosophy from London, and am studying for an MA. My philosophical interests are in Victorian-era German philosophy, Kierkegaard, Robert Nozick, hermeneutics and current approaches to the demarcation problem in the philosophy of science. 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.

Elsewhere:

  • GPG Key
  • del.icio.us
  • Flickr
  • Twitter
  • digg
  • 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