summaryrefslogtreecommitdiff
path: root/util.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 /util.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 'util.c')
-rw-r--r--util.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/util.c b/util.c
index ca7cacfea6..1fb9ef2f38 100644
--- a/util.c
+++ b/util.c
@@ -575,11 +575,18 @@ Perl_set_numeric_radix(pTHX)
struct lconv* lc;
lc = localeconv();
- if (lc && lc->decimal_point)
- /* We assume that decimal separator aka the radix
- * character is always a single character. If it
- * ever is a string, this needs to be rethunk. */
- PL_numeric_radix = *lc->decimal_point;
+ if (lc && lc->decimal_point) {
+ if (lc->decimal_point[0] == '.' && lc->decimal_point[1] == 0) {
+ SvREFCNT_dec(PL_numeric_radix);
+ PL_numeric_radix = 0;
+ }
+ else {
+ if (PL_numeric_radix)
+ sv_setpv(PL_numeric_radix, lc->decimal_point);
+ else
+ PL_numeric_radix = newSVpv(lc->decimal_point, 0);
+ }
+ }
else
PL_numeric_radix = 0;
# endif /* HAS_LOCALECONV */