Archive for May 29th, 2008

PHP: Multi-byte-safe number_format function

I recently ran into a problem with PHP’s built-in number_format function. The function is actually quite handy: It allows you to format a number in a manner that is appropriate for the language your website is currently in.

Example: To write the number 4505 and 31 hundredths in English, you’d write “4,505.31″. In German or Spanish however, the comma is the decimal separator, in turn using the point as the “digit group separator”: “4.505,31″. Swiss German, however, uses an apostrophe-like character as a digit group separator: “4′505,31″. And so on, and so forth.

All of these are supposedly addressed by using the number_format() function, feeding it the number to be displayed and the regionally appropriate separator characters.

Sadly though, when you do this for Russian and other eastern European languages, your result looks like this: Read the rest of this entry »

Half taken off

Pittsburgh (source: Wikipedia.org)My take-off to Pittsburgh is coming closer and closer, and in the meantime, my to-do list seems to be getting longer and longer, but I am bravely fighting through it :).

What’s kind of weird is the housing situation in Pittsburgh: I’ve been writing emails to a bunch of landlord and landladies that I found on craigslist, but most people want to rent out their rooms for a 12 months lease, minimum, and 9 months is not acceptable.

Others just want me to send a check from a distance, rather than making an appointment to look at the place. Riiight. I am going to give you money just like that.

The last group posts quite appealing ads with descriptions of how their apartment is, what the room to be rented is like, how conveniently it’s located, etc etc, and once you reach the end of the ad, it say “females only”. Noooo…

In spite of these little problems, I am looking forward to go to Pittsburgh soon. I’m sure it’ll be fun.