Bug 16578: Fix wide character errors in opac-export.pl

This simple patch fixes wide character warning raised by opac-export.pl when
'MARC (Unicode/UTF-8)' and 'MARC (Unicode/UTF-8, Standard)' formats are chosen
for downloading records.

To test:
- Have records indexed
- Open your OPAC logs:
  $ tail -f /var/log/koha/kohadev/opac-error.log
- Open the detail page in the opac for a record
- Choose Save record > MARC (Unicode/UTF-8)
=> FAIL: opac-export.pl: Wide character in print at /home/vagrant/kohaclone/opac/opac-export.pl line 116., referer: http://localh...
- Choose Save record > MARC (Unicode/UTF-8, Standard)
=> FAILE opac-export.pl: Wide character in print...
- Apply the patch
- Choose Save record > MARC (Unicode/UTF-8)
=> SUCCESS: No warnings raised.
- Choose Save record > MARC (Unicode/UTF-8, Standard)
=> SUCCESS: No warnings raised.
- Sign off :-D

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7d4844e171)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Tomas Cohen Arazi 2016-05-24 14:28:44 -03:00 committed by Frédéric Demians
parent c5fc0fcd0e
commit 164ffdb43c
1 changed files with 8 additions and 5 deletions

View File

@ -17,8 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
use warnings;
use Modern::Perl;
use C4::Record;
use C4::Auth;
@ -107,11 +106,15 @@ else {
-charset => 'utf-8',
-attachment => "bib-$biblionumber.txt"
);
}else{
} else {
binmode STDOUT, ':encoding(UTF-8)';
print $query->header(
-type => 'application/octet-stream',
-charset=>'utf-8',
-attachment=>"bib-$biblionumber.$format");
-charset => 'utf-8',
-attachment => "bib-$biblionumber.$format"
);
}
print $marc;
}
1;