You are here: Foswiki>Tasks Web>Item14216 (18 Feb 2017, GeorgeClark)Edit Attach

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
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
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/ b/MailerContrib/lib/Foswiki/Contrib/
index cdbc1f6..49e56cf 100644
--- a/MailerContrib/lib/Foswiki/Contrib/
+++ b/MailerContrib/lib/Foswiki/Contrib/
@@ -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

ItemTemplate edit

Summary MailerContrib mailnotify fails with wide character print when run from Web when unicode webnames are in use.
ReportedBy GeorgeClark
Codebase 2.1.2, trunk
SVN Range
AppliesTo Extension
Component MailerContrib
Priority Urgent
CurrentState Closed
Checkins distro:9884d569b364
TargetRelease patch
ReleasedIn 2.1.3
CheckinsOnBranches Release02x01 master
masterCheckins distro:9884d569b364
Release02x01Checkins distro:9884d569b364
Topic revision: r5 - 18 Feb 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy