Bug 12581 - /svc/bib endpoint has encoding issues when updating a record
Summary: /svc/bib endpoint has encoding issues when updating a record
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-16 07:47 UTC by Petter Goksøyr Åsen
Modified: 2015-06-04 23:23 UTC (History)
2 users (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
Bug 12581 - Fix encoding issues in /svc/bib endpoint (2.20 KB, patch)
2014-07-16 08:01 UTC, Petter Goksøyr Åsen
Details | Diff | Splinter Review
Bug 12581 - Fix encoding issues in /svc/bib endpoint (2.25 KB, patch)
2014-08-08 03:05 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Petter Goksøyr Åsen 2014-07-16 07:47:55 UTC
Updating a record by sending a POST request with the MARCXML data Koha's /svc/bib endpoint can result in mangled characters in the saved record.
Comment 1 Petter Goksøyr Åsen 2014-07-16 08:01:16 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-08-08 03:05:52 UTC
Created attachment 30612 [details] [review]
Bug 12581 - Fix encoding issues in /svc/bib endpoint

Updating a record by sending a POST request with the MARCXML data Koha's
/svc/bib endpoint can result in mangled characters in the saved record.
By contrast, the /svc/new_bib endpoint, for creating a new record,
correctly fixes theese encoding issues.

This patch replicates the fix from svc/new_bib to svc/bib.

Test plan
* Update a record by sending MARCXML to the /svc/bib endpoint.
  The record should contain non-latin characters, for example æ,ø, å.
* Observe that the returned response, and the record in the database
  has mangled characters.
* Apply the patch
* Repeat the first step
* Observe that the record now is free from encoding errors.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 3 Katrin Fischer 2014-08-17 19:29:14 UTC
I am making my first steps with the svc API and I managed to update a record using:
curl 'http://localhost:8080/cgi-bin/koha/svc/bib/30' --cookie /tmp/svc.cookies --header "Content-type: text/xml" --data @/home/katrin/Downloads/bib-30.marcxml 

But I can't reproduce the encoding problem :(

I tried with a record containing the characters listed in the patch and Arabic.
Comment 4 Katrin Fischer 2014-08-17 20:53:03 UTC
Some additional information:
- I had downloaded the record from my Koha database.
- I changed it in an editor, the changes were reflected in what I saw on 
  command line and in Koha after the update.
- All diacritics showed up correctly at all times.

Could you please try again if the problem is still there for you and provide me with a test plan and an example record?
Comment 5 Petter Goksøyr Åsen 2014-08-18 03:01:33 UTC
Hi Katrin, Thanks for QA!

You're right. Somehow, it now mysteriously works for me too on master. I can't understand why. It must have been something weird with my environment, or else some changes in master which now resolved the issue.

Either way, I'm happy to close this. The less code the better:)
Comment 6 Katrin Fischer 2014-08-18 05:50:21 UTC
Hi Petter, thx for retesting! Just changing the status a bit to imply that this patch isn't needed for now.