mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make code to detect thousands separator a little more robust
This commit is contained in:
parent
7f6ade6be0
commit
7a53b7dd61
@ -323,11 +323,13 @@ def get_windows_number_formats():
|
|||||||
raise ctypes.WinError()
|
raise ctypes.WinError()
|
||||||
src = buf.value
|
src = buf.value
|
||||||
thousands_sep, decimal_point = u',.'
|
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')
|
idx = src.find(u'6')
|
||||||
if idx > -1 and src[idx+1] != u'7':
|
if idx > -1 and src[idx+1] != u'7':
|
||||||
decimal_point = src[idx+1]
|
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)
|
number_formats = (thousands_sep, decimal_point)
|
||||||
return number_formats
|
return number_formats
|
||||||
|
Loading…
x
Reference in New Issue
Block a user