]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/MIME.pm
Merge branch 'don/processencoding' of git+ssh://git.donarmstrong.com/srv/git/debbugs...
[debbugs.git] / Debbugs / MIME.pm
index 640627651581826bf8bcce5570d8acb46085a3ce..05534e3e054c47d2cb281f683aaacf1a0ac7a52e 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': $@";
@@ -316,7 +314,7 @@ sub encode_rfc1522 {
               if (length $encoded > 75) {
                    # Turn utf8 into the internal perl representation
                    # so . is a character, not a byte.
-                   my $tempstr = decode_utf8($word,Encode::FB_DEFAULT);
+                   my $tempstr = is_utf8($word)?$word:decode_utf8($word,Encode::FB_DEFAULT);
                    my @encoded;
                    # Strip it into 10 character long segments, and encode
                    # the segments