Item14216: MailerContrib mailnotify fails with wide character print when run from Web when unicode webnames are in use.
Priority: Urgent
Current State: Closed
Released In: 2.1.3
Target Release: patch
Applies To: Extension
Component: MailerContrib
Branches: Release02x01 master
My test system has a unicode webname:
Litterbox/Úňíčôďě
When mailnotify is run from the shell, it runs fine, no errors encountered.
When mailnotify is run from the Web interface, it fails with Wide Character in Print. It fails in sub _processWeb line 225. Adding a $printableWeb = Foswiki::encode_uft8($web) fixes the crash, but the output is still not correct. After utf8 encoding, it shows as follows in both the shell (which was working) and in the web.
Processing Litterbox/ÚňÃÄôÄÄ›
--
GeorgeClark - 15 Nov 2016
Attempted fix - fails.
diff --git a/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm b/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
index cdbc1f6..49e56cf 100644
--- a/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
+++ b/MailerContrib/lib/Foswiki/Contrib/MailerContrib.pm
@@ -225,14 +225,15 @@ sub _processWeb {
return '';
}
- print "Processing $web\n" if $options->{verbose};
+ my $printableWeb = Foswiki::encode_utf8($web);
+ print "Processing $printableWeb\n" if $options->{verbose};
# Read the webnotify and load subscriptions
my $wn =
Foswiki::Contrib::MailerContrib::WebNotify->new( $web,
$Foswiki::cfg{NotifyTopicName}, 0 );
if ( $wn->isEmpty() ) {
- print "\t$web has no subscribers\n" if $options->{verbose};
+ print "\t$printableWeb has no subscribers\n" if $options->{verbose};
}
else {
--
GeorgeClark - 15 Nov 2016
Crawford, if you could take a look at this please. I assume there is something going on with how the STDOUT is opened in the shell vs. the CGI environments.
--
GeorgeClark - 15 Nov 2016
Never mind, figured it out.
- The REST handler was not setting the
-charset => 'UTF-8'
when generating CGI output
- The data is not utf8 encoded before print.
--
GeorgeClark - 16 Nov 2016