diff options
author | Karl Williamson <khw@cpan.org> | 2016-02-10 14:21:24 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-02-10 21:16:44 -0700 |
commit | 3dbc6af5bbf573b8a656c27f7beffd8e552ccd64 (patch) | |
tree | 94a76c875f635dfe19af10e7da29113a88c2410b /sv.c | |
parent | e29d83e275fddfa5dff93b81c390faeb10b4bf17 (diff) | |
download | perl-3dbc6af5bbf573b8a656c27f7beffd8e552ccd64.tar.gz |
sv.c: Handle radix being multi-byte and not UTF-8
While reviewing this code, I realized that the decimal point could
legally be a sequence of characters, not just a single one. I don't
know of any cases of that happening, but it's easy to handle that
possibility.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -3121,10 +3121,7 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) DECLARATION_FOR_LC_NUMERIC_MANIPULATION; STORE_LC_NUMERIC_SET_TO_NEEDED(); - local_radix = - PL_numeric_local && - PL_numeric_radix_sv && - SvUTF8(PL_numeric_radix_sv); + local_radix = PL_numeric_local && PL_numeric_radix_sv; if (local_radix && SvLEN(PL_numeric_radix_sv) > 1) { size += SvLEN(PL_numeric_radix_sv) - 1; s = SvGROW_mutable(sv, size); @@ -3134,8 +3131,10 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) /* If the radix character is UTF-8, and actually is in the * output, turn on the UTF-8 flag for the scalar */ - if (local_radix && - instr(s, SvPVX_const(PL_numeric_radix_sv))) { + if ( local_radix + && SvUTF8(PL_numeric_radix_sv) + && instr(s, SvPVX_const(PL_numeric_radix_sv))) + { SvUTF8_on(sv); } |