cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
You are here: Foswiki>Tasks Web>Item12423 (19 Nov 2013, GeorgeClark)Edit Attach

Item12423: Wrong encoding for compare

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.9
Target Release: patch
Applies To: Extension
Component: CompareRevisionsAddOn
Branches: Release01x01 trunk
Reported By: PiotrRoszatycki
Waiting For:
Last Change By: GeorgeClark
Wrong encoding with pl_PL.UTF-8 locale:

"Różnice: WebHome (r6 vs. r5)"

should be

"Różnice: WebHome (r6 vs. r5)"

Pull request: https://github.com/foswiki/CompareRevisionsAddOn/pull/1

Patch:

diff --git a/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm b/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm
index 86ade37..96edc3d 100755
--- a/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm
+++ b/lib/Foswiki/Contrib/CompareRevisionsAddOn/Compare.pm
@@ -239,6 +239,10 @@ sub compare {
         # Do the replacement of %TEXT1% and %TEXT2% simultaneously
         # to prevent difficulties with text containing '%TEXT2%'
         $tmpl =~ s/%TEXT(1|2)%/$1==1?$text1:$text2/ge;
+
+        my $charset = $Foswiki::cfg{Site}{CharSet} || 'iso-8859-1';
+        $tmpl = Encode::encode( $charset, $tmpl );
+
         $output .= $tmpl;
 
     }
@@ -292,10 +296,6 @@ sub compare {
 
     $output .= $tmpl_after;
 
-    # Item12337: part of alternative fix for Item11755
-    my $charset = $Foswiki::cfg{Site}{CharSet} || 'iso-8859-1';
-    $output = Encode::encode( $charset, $output );
-
     # Break circular references to avoid memory leaks. (Tasks:9127)
     $tree1 = $tree1->parent() while defined $tree1->parent();
     $tree1->delete();

Topic revision: r6 - 19 Nov 2013, GeorgeClark - This page was cached on 21 Mar 2018 - 18:06.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License