My new blog is here

Character encoding hell Permanent link to this item in the archive.

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? Permanent link to this item in the archive.

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

HomeTom MorrisOpiumfield

Last modified: Monday, December 17, 2007 at 12:41 AM.

November 2007
Sun
Mon
Tue
Wed
Thu
Fri
Sat
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Oct   Dec

This is my old blog. Please visit the new one.

Send me a voice message via Odea PayPal
 Subscribe

My podcast (RSS)