Bugzilla – Attachment 46513 Details for
Bug 15190
Bad utf8 decode to unapi and fixing code status 200
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15190: Bad utf8 decode to unapi and fixing status code 200
Bug-15190-Bad-utf8-decode-to-unapi-and-fixing-stat.patch (text/plain), 2.35 KB, created by
Héctor Eduardo Castro Avalos
on 2016-01-12 04:38:59 UTC
(
hide
)
Description:
Bug 15190: Bad utf8 decode to unapi and fixing status code 200
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2016-01-12 04:38:59 UTC
Size:
2.35 KB
patch
obsolete
>From 88362bedfaef22a1e34ee98afc07b060c5216cd8 Mon Sep 17 00:00:00 2001 >From: Hector Castro <hector.hecaxmmx@gmail.com> >Date: Mon, 11 Jan 2016 22:34:01 -0600 >Subject: [PATCH] Bug 15190: Bad utf8 decode to unapi and fixing status code > 200 > >Fix bad utf8 decoding, also fix status code 200 for no parameters passed to >script > >To reproduce the issue in OPAC >1) Copy from LOC (Z39.50) ISBN 8467020113 or test it with whichever record with > special characters >2) Open URL in OPAC cgi-bin/koha/unapi?id=koha:biblionumber:4&format=oai_dc > play with oai_dc, srw_dc, mods, mods-full, mods3, mods3-full, rdfdc. > Note: marcxml does not fail >3) Enter the new biblionumber for ISBN 8467020113 or the record of your choise >4) An oai_dc record will display, notice about the bad utf8 > decoding characters >5) Search the record in OPAC >6) To reproduce code 200 Ok and 300 Multiple choices play with: > cgi-bin/koha/unapi > cgi-bin/koha/unapi?id=koha:biblionumber:4 >7) If possible test in NORMARC (UNIMARC will launch an error because bug 15162) > >Test plan >-Apply patch >-Follow steps 2 to 6 >-You will see no errors in utf8 >--- > opac/unapi | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/opac/unapi b/opac/unapi >index 7b21ee0..1b9281d 100755 >--- a/opac/unapi >+++ b/opac/unapi >@@ -144,14 +144,14 @@ if (not defined $format) { > my $parser = XML::LibXML->new(); > my $record_dom = $parser->parse_string( $marcxml ); > $record_dom = $transformer->transform( $record_dom ); >- $content = $record_dom->toString(); >+ $content = $transformer->output_as_chars( $record_dom ); > }; > if ($@) { > print $cgi->header( -status => '500 internal error ' . $@->code() . ": " . $@->message() ); > exit 0; > } > >- print $cgi->header( -type =>'application/xml' ); >+ print $cgi->header( -type =>'application/xml', -charset => 'UTF-8' ); > print $content; > } else { > # ID is obviously wrong, so 404 >@@ -172,7 +172,7 @@ sub emit_formats { > if (defined $id) { > print $cgi->header( -type =>'application/xml', -status => '300 multiple choices' ); > } else { >- print $cgi->header( -type =>'application/xml' ); >+ print $cgi->header( -type =>'application/xml', -status => '200 Ok' ); > } > > print "<?xml version='1.0' encoding='utf-8' ?>\n"; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15190
:
44861
|
44887
|
45427
|
45428
|
45432
|
46513
|
46574
|
46581