]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/UTF8.pm
when we fail to commit to utf8, output the charset and data
[debbugs.git] / Debbugs / UTF8.pm
index 74a40427412fe402bc81bb4b9cb631e6985995f6..7ab8f9cb619954a1e1fbe6f3056fdc3f99397d3a 100644 (file)
@@ -151,7 +151,7 @@ sub convert_to_utf8 {
         cluck("utf8 flag is set when calling convert_to_utf8");
         return $data;
     }
-    $charset = uc($charset);
+    $charset = uc($charset//'UTF-8');
     if ($charset eq 'RAW') {
         croak("Charset must not be raw when calling convert_to_utf8");
     }
@@ -178,7 +178,7 @@ sub convert_to_utf8 {
     if (not defined $retval or
         $retval < 0
        ) {
-        warn "failed to convert to utf8";
+        warn "failed to convert to utf8 (charset: $charset, data: $data)";
         # Fallback to encode, which will probably also fail.
         return __fallback_convert_to_utf8($data,$charset);
     }