From: dklawren Date: Thu, 21 May 2020 13:50:29 +0000 (-0400) Subject: Bug 1639311 - Attaching a file with emojis breaks them X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3a3a8f0d548f92c3097ae6e806593a0401ef25d;p=thirdparty%2Fbugzilla.git Bug 1639311 - Attaching a file with emojis breaks them --- diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 08ca3ef39..dad6d3df2 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -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;