OSDN Git Service

fix text format-related functions
[newslash/newslash.git] / src / newslash_web / lib / Newslash / Util / TextFormatter.pm
index 3565d55..3961672 100644 (file)
@@ -15,6 +15,7 @@ our @EXPORT_OK = qw(strip_by_mode);
 use EscapeHTML qw();
 use HTML::Tidy;
 use Data::Dumper;
+use Encode;
 
 use constant ANCHOR    => -4;
 use constant NOTAGS    => -3;
@@ -555,6 +556,7 @@ sub tidy_html {
                                  'show-body-only' => 1,
                      } );
     my $tidyed = $tidy->clean($html);
+    chomp($tidyed);
     return $tidyed;
 }
 
@@ -586,7 +588,6 @@ sub clean_html {
                                  'show-body-only' => 1,
                      } );
     my $tidyed = $tidy->clean($escaped);
-    chomp($tidyed);
     return $tidyed;
 }