Bug 28094

Summary: Fix bad encoding of OVERRIDE_SYSPREF_LibraryName
Product: Koha Reporter: Magnus Enger <magnus>
Component: OPACAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, fridolin.somers, jonathan.druart, julian.maurice, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05,20.05.11
Attachments: Bug 28094: Deal with encoding for overriden sysprefs
Bug 28094: Deal with encoding for overriden sysprefs
Bug 28094: Deal with encoding for overriden sysprefs

Description Magnus Enger 2021-04-06 11:47:55 UTC
I am creating alternative OPACs for a Koha site using the SetEnv techniques. When I set this in the Apache config:

  RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_LibraryName Slægtsforskernes Bibliotek"

there is a problem with the encoding, the name is displayed like this:

  Slægtsforskernes Bibliotek

If I try to replace the "æ" with &aelig;, that text is displayed as is, and not replaced by the proper letter:

  Sl&aelig;gtsforskernes Bibliotek

Anyone got a clue how to fix this?
Comment 1 Jonathan Druart 2021-04-06 14:29:20 UTC
Created attachment 119221 [details] [review]
Bug 28094: Deal with encoding for overriden sysprefs

The string we retrieved is UTF-8 encoded, to prevent encoding issue we
must decode it first.

Test plan:
Easily testable with LibraryName:
1. edit /etc/apache2/sites-available/kohadev.conf
2. Add
  RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_LibraryName Library of ❤️"
3. restart_all
4. Hit the mainpage and look at the source (or title) and confirm that
the string is displayed correcty
Comment 2 Lucas Gass 2021-04-06 20:38:53 UTC
Created attachment 119245 [details] [review]
Bug 28094: Deal with encoding for overriden sysprefs

The string we retrieved is UTF-8 encoded, to prevent encoding issue we
must decode it first.

Test plan:
Easily testable with LibraryName:
1. edit /etc/apache2/sites-available/kohadev.conf
2. Add
  RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_LibraryName Library of ❤️"
3. restart_all
4. Hit the mainpage and look at the source (or title) and confirm that
the string is displayed correcty

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 3 Julian Maurice 2021-04-09 10:24:02 UTC
Created attachment 119369 [details] [review]
Bug 28094: Deal with encoding for overriden sysprefs

The string we retrieved is UTF-8 encoded, to prevent encoding issue we
must decode it first.

Test plan:
Easily testable with LibraryName:
1. edit /etc/apache2/sites-available/kohadev.conf
2. Add
  RequestHeader add X-Koha-SetEnv "OVERRIDE_SYSPREF_LibraryName Library of ❤️"
3. restart_all
4. Hit the mainpage and look at the source (or title) and confirm that
the string is displayed correcty

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 4 Jonathan Druart 2021-04-09 14:41:23 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 5 Magnus Enger 2021-04-12 08:05:57 UTC
Wow, thanks for fixing this so quickley!
Comment 6 Fridolin Somers 2021-04-19 10:17:15 UTC
Pushed to 20.11.x for 20.11.05
Comment 7 Andrew Fuerste-Henry 2021-04-25 14:26:02 UTC
Pushed to 20.05.x for 20.05.11
Comment 8 Victor Grousset/tuxayo 2021-04-25 17:20:00 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.