From 36dc61d63c811826d98097b5defb65de581c5262 Mon Sep 17 00:00:00 2001 From: Blou Date: Tue, 21 Jul 2015 16:07:59 -0400 Subject: [PATCH] Bug 14584 - Encoding broken with system preferences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents double-encoding the strings from the database's systempreferences. STEP 1) You need an accentuated language installed. 2) Go to NoLoginInstructions pref, and add some accentuated message like "Hélo médames é mècieüx" 3) refresh opac home page, message should be gibberish 4) apply patch. Message should be ok now. --- Koha/Template/Plugin/Koha.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm index ecb6266..f94579b 100644 --- a/Koha/Template/Plugin/Koha.pm +++ b/Koha/Template/Plugin/Koha.pm @@ -43,7 +43,8 @@ is necessary. sub Preference { my ( $self, $pref ) = @_; - return encode('UTF-8', C4::Context->preference( $pref ) ); + my $str = C4::Context->preference( $pref ); + return C4::Charset::IsStringUTF8ish($str) ? $str : encode('UTF-8', $str); } sub Version { -- 2.1.0