]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/MIME.pm
read the log file as utf8 by default
[debbugs.git] / Debbugs / MIME.pm
index c2faeaa8621b3f5c580beb5c450425c1d39f9b6c..bc47ca3a7b0a94e549fafd49dd473505fa3d7157 100644 (file)
@@ -229,9 +229,7 @@ sub convert_to_utf8 {
      return $data if $charset eq 'raw' or is_utf8($data,1);
      my $result;
      eval {
-         # this encode/decode madness is to make sure that the data
-         # really is valid utf8 and that the is_utf8 flag is off.
-         $result = encode("utf8",decode($charset,$data))
+        $result = decode($charset,$data);
      };
      if ($@) {
          warn "Unable to decode charset; '$charset' and '$data': $@";
@@ -286,6 +284,9 @@ sub encode_rfc1522 {
 
      # handle being passed undef properly
      return undef if not defined $rawstr;
+     if (is_utf8($rawstr)) {
+        $rawstr= encode_utf8($rawstr);
+     }
      # We process words in reverse so we can preserve spacing between
      # encoded words. This regex splits on word|nonword boundaries and
      # nonword|nonword boundaries. We also consider parenthesis and "