Steve Phillips

Drupal switch

Rather than switching my old site to Drupal, I've decided to just migrate to a new Drupal site. I will no longer be posting on and will begin anew here on A number of factors led to this decision.


MySQL dump of every country and state in the world

As part of a recent project, I needed to compile a list of every country and first level administrative subdivision in the world. I started with the ISO 3166-2 list, but later cleaned up certain countries that had inaccurate data. I also needed timezones for every state, so I put all of those in as well.

This zip file contains a single SQL dump for two tables – region and subregion.


Dealing with PHP and character encoding

How many times have you been presented with a character encoding glitch on a PHP site that you thought was working properly? You finished the site months ago with no issues, but now you are being told some weird character is showing up on that page? Chances are, that character is either Ã, Â or Ä, possibly followed by some other random character. If I’m right, keep reading. If not, I offer my deepest condolences, for you are knee deep in a character encoding issue that I cannot help you with.

How to unchunk data received through PHP sockets

When using the PHP socket functions to pull data from another website, you'll often find yourself dealing with chunked data. Chunked data often looks like this: