From d3a3a8f0d548f92c3097ae6e806593a0401ef25d Mon Sep 17 00:00:00 2001 From: dklawren Date: Thu, 21 May 2020 09:50:29 -0400 Subject: [PATCH] Bug 1639311 - Attaching a file with emojis breaks them --- Bugzilla/Util.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.3