summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-01-30 20:26:33 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-01-30 20:26:33 +0000
commiteff180cdf66484c41f3aacf26a4fd81d2be06de0 (patch)
tree41b13d1fdeacac1cc47a39c570a00084458e0a0c /sv.c
parent1d61552279452016689faf899b5e1f418a500278 (diff)
downloadperl-eff180cdf66484c41f3aacf26a4fd81d2be06de0.tar.gz
Fix for the fa_IR locale failure. The reason for the failure
was that Perl was assuming the decimal separator aka the radix separator is one character. The Farsi-Iranian locale crushed that bad assumption since there the separator is 'Momayyez', glyphwise looking somewhat like a slash, and in Unicode UTF-8 encoded in two bytes, 0xd9 0xab. p4raw-id: //depot/perl@8625
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 7bd628e5ce..09ca49a67e 100644
--- a/sv.c
+++ b/sv.c
@@ -2448,6 +2448,7 @@ Perl_looks_like_number(pTHX_ SV *sv)
I32 numtype = 0;
I32 sawinf = 0;
STRLEN len;
+ bool specialradix = FALSE;
if (SvPOK(sv)) {
sbegin = SvPVX(sv);
@@ -2514,10 +2515,13 @@ Perl_looks_like_number(pTHX_ SV *sv)
if (*s == '.'
#ifdef USE_LOCALE_NUMERIC
- || IS_NUMERIC_RADIX(*s)
+ || (specialradix = IS_NUMERIC_RADIX(s))
#endif
) {
- s++;
+ if (specialradix)
+ s += SvCUR(PL_numeric_radix);
+ else
+ s++;
numtype |= IS_NUMBER_NOT_INT;
while (isDIGIT(*s)) /* optional digits after the radix */
s++;
@@ -2525,10 +2529,13 @@ Perl_looks_like_number(pTHX_ SV *sv)
}
else if (*s == '.'
#ifdef USE_LOCALE_NUMERIC
- || IS_NUMERIC_RADIX(*s)
+ || (specialradix = IS_NUMERIC_RADIX(s))
#endif
) {
- s++;
+ if (specialradix)
+ s += SvCUR(PL_numeric_radix);
+ else
+ s++;
numtype |= IS_NUMBER_TO_INT_BY_ATOL | IS_NUMBER_NOT_INT;
/* no digits before the radix means we need digits after it */
if (isDIGIT(*s)) {