diff options
author | Karl Williamson <khw@cpan.org> | 2017-08-18 13:46:25 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2017-08-18 14:35:48 -0600 |
commit | a8f4b0c691d6f1b08948976e74087b646bf8c6ef (patch) | |
tree | 16450eb766a4f749c876d5007584fed9ee5541a6 /embed.h | |
parent | 9d8092f2bf23932b723d0dbded2b652c8d9b135e (diff) | |
download | perl-a8f4b0c691d6f1b08948976e74087b646bf8c6ef.tar.gz |
Improve heuristic for UTF-8 detection in "$!"
Previously, the stringification of "$!" was considered to be UTF-8 if it
had any characters with the high bit set, and everything was
syntactically legal UTF-8. This may to correctly guess on short strings
where there are only a few non-ASCII bytes. This could happen in
languages based on the Latin script where many words don't use
non-ASCII.
This commit adds a check that the locale is a UTF-8 one. That check is
a call to an already-existing subroutine which goes to some lengths to
get an accurate answer, and should be essentially completely reliable on
modern systems that have nl_langinfo() and/or mbtowc().
See the thread starting at
http://nntp.perl.org/group/perl.perl5.porters/245902
Diffstat (limited to 'embed.h')
-rw-r--r-- | embed.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -885,7 +885,7 @@ #define sv_dup(a,b) Perl_sv_dup(aTHX_ a,b) #define sv_dup_inc(a,b) Perl_sv_dup_inc(aTHX_ a,b) #endif -#if defined(USE_LOCALE) && (defined(PERL_IN_LOCALE_C) || defined (PERL_EXT_POSIX)) +#if defined(USE_LOCALE) && ( defined(PERL_IN_LOCALE_C) || defined(PERL_IN_MG_C) || defined (PERL_EXT_POSIX)) #define _is_cur_LC_category_utf8(a) Perl__is_cur_LC_category_utf8(aTHX_ a) #endif #if defined(USE_LOCALE_COLLATE) |