]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1639311 - Attaching a file with emojis breaks them
authordklawren <dklawren@users.noreply.github.com>
Thu, 21 May 2020 13:50:29 +0000 (09:50 -0400)
committerGitHub <noreply@github.com>
Thu, 21 May 2020 13:50:29 +0000 (09:50 -0400)
Bugzilla/Util.pm

index 08ca3ef3926c608ef07e4dd8fde055605c3a68d8..dad6d3df2324474b46b92ad08a641e3ce0617832 100644 (file)
@@ -920,7 +920,7 @@ sub detect_encoding {
   # Encode::Detect sometimes mis-detects UTF-8 as Windows-1252
   if ($encoding && $encoding eq 'cp1252') {
     my $decoder = guess_encoding($data, ('utf8', 'cp1252'));
-    $encoding = $decoder->name if ref $decoder;
+    $encoding = ref $decoder ? $decoder->name : 'utf8'; # Fall back to utf8 if guess_encoding fails
   }
 
   return $encoding;