Bug 28446 - Fix encoding of OverDrive content on Your summary, OverDrive Account
Summary: Fix encoding of OverDrive content on Your summary, OverDrive Account
Status: RESOLVED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: 20.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Magnus Enger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-25 13:10 UTC by Magnus Enger
Modified: 2023-07-01 09:38 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Screenshot of bad encoding (85.64 KB, image/png)
2021-05-25 13:10 UTC, Magnus Enger
Details
Bug 28446: Fix encoding of OverDrive content (1.51 KB, patch)
2021-05-26 07:52 UTC, Magnus Enger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2021-05-25 13:10:24 UTC
Created attachment 121377 [details]
Screenshot of bad encoding

If you have borrowed a book from OverDrive it will show on "Your summary", on the "OverDrive Account" tab. The display includes the title and description, but this text is encoded wrong, see attached screenshot. 

It looks like the fix is to use to_json instead of encode_json in the call to output_with_http_headers in opac/svc/overdrive:

  output_with_http_headers $cgi, undef, to_json($data), 'json', $status_line;

I will submit a patch for this once my customer has verified it does not break anything else.
Comment 1 Magnus Enger 2021-05-26 07:52:44 UTC
Created attachment 121411 [details] [review]
Bug 28446: Fix encoding of OverDrive content

Descriptions and titles from OverDrive have their non-ascii chars
displayed wrong.

To test:
- Enable OverDrive
- Do a search and find a book with non-ascii characters in title
  and/or description. E.g. "Blomsterbönder".
- Check the book out
- Go to "your summary" and the "OverDrive Account" tab
- Observe the broken characters
- Apply the patch and restart all the things
- Reload the "your summary" page
- Look at the "OverDrive Account" tab again, and verify the text
  is displayed without broken characters
- Sign off
Comment 2 Katrin Fischer 2021-06-03 20:41:49 UTC
Hm, not sure how this can be tested easily - those with Overdrive accounts might not have the required material with special characters. Magnus, do you have someone who could test this maybe?
Comment 3 Owen Leonard 2021-06-08 14:21:08 UTC
Magnus have you tested this in master? I can't reproduce in master but I'm not sure if it's specific to 20.11.x or if I don't have an exotic-enough OverDrive record.

I see:

Lyd & Bilde, Skandinavias største hjemmeelektronikkmagasin â nå også i digitalt format på Zinio! Abonner nå â Et tilbud du ikke kan takke nei til!

and

Le magazine de référence de la photo. Dans PHOTO se côtoient les plus grands photographes internationaux : reportage, mode, pub, sport, nu, portrait... Le magazine PHOTO incarne les tendances esthétiques d'aujourd'hui et vous fait découvrir les talents.
Comment 4 Katrin Fischer 2023-07-01 09:38:24 UTC
(In reply to Owen Leonard from comment #3)
> Magnus have you tested this in master? I can't reproduce in master but I'm
> not sure if it's specific to 20.11.x or if I don't have an exotic-enough
> OverDrive record.
> 
> I see:
> 
> Lyd & Bilde, Skandinavias største hjemmeelektronikkmagasin â nå også i
> digitalt format på Zinio! Abonner nå â Et tilbud du ikke kan takke nei til!
> 
> and
> 
> Le magazine de référence de la photo. Dans PHOTO se côtoient les plus grands
> photographes internationaux : reportage, mode, pub, sport, nu, portrait...
> Le magazine PHOTO incarne les tendances esthétiques d'aujourd'hui et vous
> fait découvrir les talents.

Marking as FIXED. Please reopen if the problem still exists.