From 769c34c988f78818a92d0dee3635c483079968d0 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@gmail.com>
Date: Tue, 20 May 2014 14:22:38 -0300
Subject: [PATCH] Bug 12279: Diacritics in system preference editor broken

This patch changes how .pref files are read. Instead of going through
all our global ultra-tweaked template object, we only use gettemplate
to build the correct file name (path included) and load it using the
(at functional) YAML::Syck::LoadFile method.

Pros: Doesn't break anything for YAML::Syck pre-1.27 (the ones shipped with
      Ubuntu 14.04)
Cons: something is wrong with C4::Templates encoding/decoding, or at least
      our default setup using C4::Templates->new doesn't work properly for
      all file types.

To test:
- On clean master, install a translation like:
  cd misc/translator ; perl translate install fr-FR
- Go to sysprefs, opac
=> FAIL: descriptions are encoding-broken
- Apply the patch, reload
=> SUCCESS: Everything shows ok

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Works ok, no errors
Test:
1) with YAML::Syck 1.19, no problems before, translated preferences
encode diacritics, ej. '\xC3\xA8' for grave accented e
Page shows correctly
2) with YAML:Syck 1.27, translated preferences have unencoded diacritics,
without patch display is broken, with patch it shows correctly

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
---
 admin/preferences.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/admin/preferences.pl b/admin/preferences.pl
index 8bcdb0a..b885e3e 100755
--- a/admin/preferences.pl
+++ b/admin/preferences.pl
@@ -54,7 +54,7 @@ sub GetTab {
         local_currency => $local_currency, # currency code is used, because we do not know how a given currency is formatted.
     );
 
-    return YAML::Syck::Load( $tab_template->output() );
+    return YAML::Syck::LoadFile( $tab_template->{filename} );
 }
 
 sub _get_chunk {
-- 
2.0.0.rc2