Item13544: MetaCommentPlugin fails to post utf-8 comment text.

pencil
Priority: Urgent
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: MetaCommentPlugin
Branches: master
Reported By: GeorgeClark
Waiting For:
Last Change By: MichaelDaum
There are some unneeded Encode:: calls in my_substr. I've made them conditional, and metacomments now appear to work, basic testing with some Arabic Lorum Ipsum text. Without the change, there are wide character errors when posting a comment.

diff --git a/lib/Foswiki/Plugins/MetaCommentPlugin/Core.pm b/lib/Foswiki/Plugins/MetaCommentPlugin/Core.pm
index ecbbdc7..b82a313 100644
--- a/lib/Foswiki/Plugins/MetaCommentPlugin/Core.pm
+++ b/lib/Foswiki/Plugins/MetaCommentPlugin/Core.pm
@@ -811,9 +811,9 @@ sub my_substr {
 
   my $charset = $Foswiki::cfg{Site}{CharSet};
 
-  $string = Encode::decode($charset, $string);
+  $string = Encode::decode($charset, $string) unless $Foswiki::UNICODE;
   $string = substr($string, $offset, $length);
-  $string = Encode::encode($charset, $string);
+  $string = Encode::encode($charset, $string) unless $Foswiki::UNICODE;
 
   return $string;
 }

-- GeorgeClark - 21 Jul 2015

my_substr has been removed completely for F-2

-- MichaelDaum - 21 Jul 2015

 
Topic revision: r3 - 31 Aug 2015, MichaelDaum
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