PHP: Convert UTF-8 to Hex Codepoint values (Unicode Hexidecimal)

This is one of those strange things that sounds a lot easier to do than it is.

I originally handled this by exploding the character through this:

$array = preg_split('//u', $a);

This worked fine and the string was split into an array of unicode characters. The next part was converting it into a useful hexidecimal value.

$character = $array[0];
$value = hexdec(bin2hex($character));

I originally thought this was the way to do so – I was wrong, don’t do it. It turns out there is no real simple way to convert from UTF-8 to hex values. Instead, try the UTF8ToUnicode function here: http://hsivonen.iki.fi/php-utf8/

Include this function and use the author’s utf8ToUnicode function. It becomes simple then:

$value = utf8ToUnicode($character);
$value = $value[0];

I am only posting this because of the sheer amount of time it took for me to find this information. I hope it helps you out.

Odaiba: The Tokyo Waterfront

At the height of the real estate boom in Tokyo, an artificial waterfront project was conceived. Originally a small man-made island for military purposes, Odaiba was prime for expansion and conversion into a waterfront area. Unlike Jean Drapeau Island, people were actually permitted to live here, and in time it became a popular tourist destination. This area is also known as Tokyo Teleport Town – it was named for the future instead of a mayor that hung onto glory well past his date of expiration.

This is the Toyota Exhibition hall. They show off new car models and allow you to test drive new electric vehicles (that look like golf carts, honestly). I wanted to try but I didn’t want to wait 40 minutes to do so. You can also see some of the interesting buildings in the background.

Sunset near Tokyo Teleport Station.

Ferris Wheel – this is where I took the picture of the surrounding area. Incidentally, it is 900 yen to ride.