The Dark Balloon

A weblog by Hao Lian.
A terrible secret guarded by golems.
A note that thanks you for being born, all those years ago.

§
Tunisia, you know what you did.

All these links are fascinating because I'm a fascinating person.

del.icio.us has a little-exploited JSON API. Besides the lack of documentation, it also has one other catch: It automatically backslash-escapes single quotes and turns the quotation mark into ", possibly among other characters. I can only assume the API assumes you will immediately eval the output and then spit it out onto a web page. Hilariously, del.icio.us converts to character entities again, leading you to actually see " strewn around on that demo as pictured above from my links. Anyway, the point is PHP’s json_decode, being the black box Exception-less and soulless monster it is, will silently fail on trying to parse the mess. The solution? Below.

$s = file_get_contents("http://del.icio.us/feeds/json/hao2lian?raw");
$posts = json_decode(stripslashes($s), true);

Getting rid of the automatic character entitification is left as an exercise to the people of Tunisia, who have had it too good for far too long.

[(2008 January 7) .]

Abandon your ideas.

Use Markdown+, but not HTML. In code blocks, beware angle brackets.