Bug 28291: Make koha-translate script produce valid UTF-8 YAML files
authorJoonas Kylmälä <joonas.kylmala@helsinki.fi>
Wed, 5 May 2021 14:20:38 +0000 (17:20 +0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 7 May 2021 12:44:00 +0000 (14:44 +0200)
commit67137b3f3efa58f506f3172146130992b0baa230
treece3c82c6c3967093c622cf0062653ff08a85a372
parent311b0b3c21ac16368d352d645ae7980590094124
Bug 28291: Make koha-translate script produce valid UTF-8 YAML files

We had two problems in the LangInstaller.pm module:
 1) the PO file was read as bytes instead of as a UTF-8 text stream
 2) The YAML file being outputted was double encoded, once by setting
    the file handle to output UTF-8 and other time in the DumpFile
    function internally

To test:
1. Before applying patch do the following
$ cd misc/translator
$ ./translate update pl-PL
$ ./translate install pl-PL
$ cd -
$ less installer/data/mysql/pl-PL/marcflavour/marc21/mandatory/authorities_normal_marc21.yml
2. Notice the output of the authorities_normal_marc21.yml contains
invalid looking UTF-8 characters
3. $ git clean -d -f # to remove the old translation files
4. Apply patch and repeat the steps and notice the
authorities_normal_marc21.yml contains valid looking UTF-8 characters

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
misc/translator/LangInstaller.pm