summaryrefslogtreecommitdiff
path: root/Lib/locale.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index 7ff43561ad..ceaa6d8ff7 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -301,8 +301,8 @@ def str(val):
"""Convert float to integer, taking the locale into account."""
return format("%.12g", val)
-def atof(string, func=float):
- "Parses a string as a float according to the locale settings."
+def delocalize(string):
+ "Parses a string as a normalized number according to the locale settings."
#First, get rid of the grouping
ts = localeconv()['thousands_sep']
if ts:
@@ -311,12 +311,15 @@ def atof(string, func=float):
dd = localeconv()['decimal_point']
if dd:
string = string.replace(dd, '.')
- #finally, parse the string
- return func(string)
+ return string
+
+def atof(string, func=float):
+ "Parses a string as a float according to the locale settings."
+ return func(delocalize(string))
-def atoi(str):
+def atoi(string):
"Converts a string to an integer according to the locale settings."
- return atof(str, int)
+ return int(delocalize(string))
def _test():
setlocale(LC_ALL, "")
@@ -696,7 +699,9 @@ locale_encoding_alias = {
'euc_kr': 'eucKR',
'utf_8': 'UTF-8',
'koi8_r': 'KOI8-R',
+ 'koi8_t': 'KOI8-T',
'koi8_u': 'KOI8-U',
+ 'kz1048': 'RK1048',
'cp1251': 'CP1251',
'cp1255': 'CP1255',
'cp1256': 'CP1256',