From 7a53b7dd61228208af0301f217f9b7f6ccd55645 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 6 Jun 2016 16:11:21 +0530 Subject: [PATCH] Make code to detect thousands separator a little more robust --- src/calibre/constants.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/constants.py b/src/calibre/constants.py index 414f75a62c..a2259e75f6 100644 --- a/src/calibre/constants.py +++ b/src/calibre/constants.py @@ -323,11 +323,13 @@ def get_windows_number_formats(): raise ctypes.WinError() src = buf.value thousands_sep, decimal_point = u',.' - idx = src.find(u'3') - if idx > -1 and src[idx+1] != u'4': - thousands_sep = src[idx+1] idx = src.find(u'6') if idx > -1 and src[idx+1] != u'7': decimal_point = src[idx+1] + src = src[:idx] + for c in src: + if c not in u'123456': + thousands_sep = c + break number_formats = (thousands_sep, decimal_point) return number_formats