This appears to be related to locale-specific processing, the code looks far from optimal at the first glance.