diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-08-21 13:10:26 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-08-21 13:10:26 +0200 |
commit | f4b9cad720b9818321cbb2a7f68718cddefd3ca1 (patch) | |
tree | a67e83d050eba95484889c75483e4e52e6a8df83 /src/plugins/perl/weechat-perl.c | |
parent | 6def0cf50226057e045d0c3fba810327a02654c8 (diff) | |
download | weechat-f4b9cad720b9818321cbb2a7f68718cddefd3ca1.zip |
perl: fix display of non-ASCII chars after load of a script with Perl >= 5.38 (closes #1996)
Diffstat (limited to 'src/plugins/perl/weechat-perl.c')
-rw-r--r-- | src/plugins/perl/weechat-perl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index 1759a4810..1796679d9 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -22,6 +22,7 @@ #undef _ +#include <locale.h> #include <EXTERN.h> #include <perl.h> #include <XSUB.h> @@ -567,6 +568,10 @@ weechat_perl_load (const char *filename, const char *code) temp_script.interpreter = (PerlInterpreter *) perl_current_interpreter; perl_parse (perl_current_interpreter, weechat_perl_api_init, perl_args_count, perl_args, NULL); +#if PERL_REVISION >= 6 || (PERL_REVISION == 5 && PERL_VERSION >= 38) + /* restore the locale that could be changed by Perl >= 5.38 */ + Perl_setlocale (LC_CTYPE, ""); +#endif length = strlen (perl_weechat_code) + strlen (str_warning) + strlen (str_error) - 2 + 4 + strlen ((code) ? code : filename) + 4 + 1; perl_code = malloc (length); @@ -1290,6 +1295,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) perl_construct (perl_main); perl_parse (perl_main, weechat_perl_api_init, perl_args_count, perl_args, NULL); +#if PERL_REVISION >= 6 || (PERL_REVISION == 5 && PERL_VERSION >= 38) + /* restore the locale that could be changed by Perl >= 5.38 */ + Perl_setlocale (LC_CTYPE, ""); +#endif #endif /* MULTIPLICITY */ perl_data.config_file = &perl_config_file; |