Fixed an incorrect encoding causing an exception when it locale was used