Changed code to not use the C++ locale support, since it is very, very broken in Mac OS X.