Fix tests that are affected by the user's locale

 * Tests should produce the same results regardless of the locale they
   are run in
 * When running in the "C" locale on Linux, some tests were failing or
   crashing

Change-Id: I0c53a2e33dc952b218b33118bb46c9ab6b1f9db9