diff options
author | Karl Williamson <khw@cpan.org> | 2015-03-27 22:18:01 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2015-03-27 22:34:21 -0600 |
commit | 008e8e82d7383361068156624879df7566121878 (patch) | |
tree | ed4ce2ee78b0f0ae375a3bee84ba9848b9814a0f /perl.h | |
parent | 2b79cfef7518ea0ccd16f1b34ef8dd2b25877f35 (diff) | |
download | perl-008e8e82d7383361068156624879df7566121878.tar.gz |
Don't raise Wide char warning in UTF-8 locale
This belongs in the category of "I can't believe I did that." Commit
613abc6d16e99bd9834fe6afd79beb61a3a4734d introduced warning messages
when a multi-byte character is operated on in a single byte locale. But
the two macros introduced fail to suppress said messages when in a
multi-byte locale where the operation is perfectly valid.
This partially solves v5.22 blocker [perl #123527]. But it could still
fail if the test files are called from within a non-UTF-8 locale. I
will issue a pull request for fixing that.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -5826,12 +5826,17 @@ typedef struct am_table_short AMTS; * argument; the 2nd, is a pointer to the first byte of the UTF-8 encoded * string, and an end position which it won't try to read past */ # define _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(cp) \ - Perl_ck_warner(aTHX_ packWARN(WARN_LOCALE), \ - "Wide character (U+%"UVXf") in %s", (UV) cp, OP_DESC(PL_op)); + STMT_START { \ + if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \ + Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ + "Wide character (U+%"UVXf") in %s", \ + (UV) cp, OP_DESC(PL_op)); \ + } \ + } STMT_END # define _CHECK_AND_OUTPUT_WIDE_LOCALE_UTF8_MSG(s, send) \ STMT_START { /* Check if to warn before doing the conversion work */\ - if (ckWARN(WARN_LOCALE)) { \ + if (! PL_in_utf8_CTYPE_locale && ckWARN(WARN_LOCALE)) { \ UV cp = utf8_to_uvchr_buf((U8 *) s, (U8 *) send, NULL); \ Perl_warner(aTHX_ packWARN(WARN_LOCALE), \ "Wide character (U+%"UVXf") in %s", \ |