Sunday, 1 June 2014

Problems with international settings (locale)

I had a problem just recently where an awk script returned an error when doing simple maths e.g. 13 / 4. After some experimentation I found the culprit was the customer has their locale set to "EL_GR" (Greek) and this converted the 3.25 to 3,25, and this prevented made my script abend with an error, inspite of the fact that both variables were cast as floats.

The cure was was to "export LANG=C" or "En_US".

No comments:

Post a Comment