save locale correctly
Merge pull request #647 from zimmski/master

Query current locale before setting to something PDF-friendly

`setlocale()` only returns the current locale with a locale parameter of "0" (which does not change the locale). So we need to set the locale in two steps: 1) query the current locale; 2) set the locale to something that outputs PDF-compatible strings.