Bugzilla – Attachment 27193 Details for
Bug 11944
Cleanup Koha UTF-8
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11944: Fix encoding issue on adding a subscription
Bug-11944-Fix-encoding-issue-on-adding-a-subscript.patch (text/plain), 5.28 KB, created by
Jonathan Druart
on 2014-04-16 12:47:55 UTC
(
hide
)
Description:
Bug 11944: Fix encoding issue on adding a subscription
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-04-16 12:47:55 UTC
Size:
5.28 KB
patch
obsolete
>From ef4ce5e144166ee3b2390af32c7c659a5aa7be3c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 11 Apr 2014 15:45:10 +0200 >Subject: [PATCH] Bug 11944: Fix encoding issue on adding a subscription > >If frequencies or numbering patterns contain non-latin characters, so >output was broken. > >To reproduce: >- Create a frequency and a numbering pattern with non-latin characters >- Add a new subscription using these values >- The screen should not contain bad encoded characters. >--- > .../prog/en/modules/serials/subscription-add.tt | 16 ++++++++-------- > serials/subscription-frequency.pl | 6 +++--- > serials/subscription-numberpattern.pl | 5 +++-- > 3 files changed, 14 insertions(+), 13 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index 1402135..4910b6e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -128,7 +128,7 @@ function displaymoreoptions() { > } > > var X = 0, Y = 0, Z = 0; >- var numberingmethod = unescape(globalnumpatterndata.numberingmethod); >+ var numberingmethod = globalnumpatterndata.numberingmethod; > if(numberingmethod.match(/{X}/)) X = 1; > if(numberingmethod.match(/{Y}/)) Y = 1; > if(numberingmethod.match(/{Z}/)) Z = 1; >@@ -141,7 +141,7 @@ function displaymoreoptions() { > > if(X) { > if(globalnumpatterndata.label1) { >- $("#headerX").html(unescape(globalnumpatterndata.label1)); >+ $("#headerX").html(globalnumpatterndata.label1); > } else { > $("#headerX").html("X"); > } >@@ -157,7 +157,7 @@ function displaymoreoptions() { > } > if(Y) { > if(globalnumpatterndata.label2) { >- $("#headerY").html(unescape(globalnumpatterndata.label2)); >+ $("#headerY").html(globalnumpatterndata.label2); > } else { > $("#headerY").html("Y"); > } >@@ -173,7 +173,7 @@ function displaymoreoptions() { > } > if(Z) { > if(globalnumpatterndata.label3) { >- $("#headerZ").html(unescape(globalnumpatterndata.label3)); >+ $("#headerZ").html(globalnumpatterndata.label3); > } else { > $("#headerZ").html("Z"); > } >@@ -212,8 +212,8 @@ function modifyAdvancedPattern() { > } > > function restoreAdvancedPattern() { >- $("#patternname").attr("readonly", true).val(unescape(globalnumpatterndata.label)); >- $("#numberingmethod").attr("readonly", true).val(unescape(globalnumpatterndata.numberingmethod)); >+ $("#patternname").attr("readonly", true).val(globalnumpatterndata.label); >+ $("#numberingmethod").attr("readonly", true).val(globalnumpatterndata.numberingmethod); > > $("#advancedpredictionpatternt input").each(function() { > $(this).attr("readonly", true); >@@ -222,13 +222,13 @@ function restoreAdvancedPattern() { > var tempid = id.replace(/(\d)/, "temp$1"); > $(this).val($("#"+tempid).val()); > } else { >- $(this).val(unescape(globalnumpatterndata[id])); >+ $(this).val(globalnumpatterndata[id]); > } > }); > $("#advancedpredictionpatternt select").each(function() { > $(this).attr("disabled", true); > var id = $(this).attr('id'); >- $(this).val(unescape(globalnumpatterndata[id])); >+ $(this).val(globalnumpatterndata[id]); > }); > > $("#restoreadvancedpatternbutton").hide(); >diff --git a/serials/subscription-frequency.pl b/serials/subscription-frequency.pl >index 80c7440..1d38082 100755 >--- a/serials/subscription-frequency.pl >+++ b/serials/subscription-frequency.pl >@@ -17,12 +17,12 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >+use Modern::Perl; > use CGI; > use C4::Context; > use C4::Serials::Frequency; > use C4::Auth qw/check_cookie_auth/; >-use URI::Escape; >-use strict; >+use JSON qw( to_json ); > > my $input=new CGI; > my $frqid=$input->param("frequency_id"); >@@ -33,4 +33,4 @@ if ($auth_status ne "ok") { > my $frequencyrecord=GetSubscriptionFrequency($frqid); > binmode STDOUT, ":encoding(UTF-8)"; > print $input->header(-type => 'text/plain', -charset => 'UTF-8'); >-print "{".join (",",map { "\"$_\":\"".uri_escape_utf8($frequencyrecord->{$_})."\"" }sort keys %$frequencyrecord)."}"; >+print to_json( $frequencyrecord ); >diff --git a/serials/subscription-numberpattern.pl b/serials/subscription-numberpattern.pl >index a58b10a..2a59d02 100755 >--- a/serials/subscription-numberpattern.pl >+++ b/serials/subscription-numberpattern.pl >@@ -21,7 +21,7 @@ use Modern::Perl; > use CGI; > use C4::Serials::Numberpattern; > use C4::Auth qw/check_cookie_auth/; >-use URI::Escape; >+use JSON qw( to_json ); > > my $input=new CGI; > >@@ -34,6 +34,7 @@ if ($auth_status ne "ok") { > my $numpatternid=$input->param("numberpattern_id"); > > my $numberpatternrecord=GetSubscriptionNumberpattern($numpatternid); >+ > binmode STDOUT, ":encoding(UTF-8)"; > print $input->header(-type => 'text/plain', -charset => 'UTF-8'); >-print "{",join (",",map {"\"$_\":\"".(uri_escape_utf8($numberpatternrecord->{$_}) // '')."\"" }sort keys %$numberpatternrecord),"}"; >+print to_json( $numberpatternrecord ); >-- >1.7.10.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 11944
:
26364
|
26365
|
26366
|
26367
|
26368
|
26369
|
26370
|
26371
|
26372
|
26407
|
26408
|
26409
|
26737
|
26738
|
26739
|
26740
|
26741
|
26742
|
26743
|
26744
|
26745
|
26746
|
26747
|
26748
|
26794
|
26857
|
26858
|
26859
|
26860
|
26861
|
26862
|
26863
|
26864
|
26865
|
26866
|
26867
|
26868
|
26869
|
26870
|
26871
|
26895
|
26921
|
27021
|
27080
|
27094
|
27158
|
27159
|
27161
|
27193
|
27194
|
27195
|
27196
|
27198
|
27199
|
27200
|
27201
|
27202
|
27203
|
27204
|
27205
|
27206
|
27207
|
27208
|
27209
|
27210
|
27211
|
27212
|
27213
|
27214
|
27215
|
27216
|
27585
|
27586
|
27587
|
27588
|
27589
|
27590
|
27591
|
27592
|
27593
|
27594
|
27595
|
27596
|
27597
|
27598
|
27599
|
27600
|
27601
|
27602
|
27603
|
27880
|
27881
|
27882
|
27883
|
27884
|
27885
|
27886
|
27887
|
27888
|
27889
|
27890
|
27891
|
27892
|
27893
|
27894
|
27895
|
27896
|
27897
|
27898
|
28046
|
28047
|
28048
|
28049
|
28050
|
28051
|
28052
|
28053
|
28054
|
28055
|
28056
|
28057
|
28058
|
28059
|
28060
|
28061
|
28062
|
28063
|
28064
|
28065
|
28066
|
28097
|
28245
|
28246
|
28247
|
28248
|
28249
|
28250
|
28251
|
28252
|
28253
|
28732
|
29981
|
29982
|
29983
|
29984
|
29985
|
29986
|
29987
|
29988
|
29989
|
29990
|
29991
|
29992
|
29993
|
29994
|
29995
|
29996
|
29997
|
29998
|
29999
|
30000
|
30001
|
30002
|
30003
|
30004
|
30005
|
30006
|
30012
|
30016
|
30945
|
31299
|
35223
|
35224
|
35225
|
35226
|
35227
|
35228
|
35229
|
35230
|
35231
|
35232
|
35233
|
35234
|
35235
|
35236
|
35237
|
35238
|
35239
|
35240
|
35241
|
35242
|
35243
|
35244
|
35245
|
35246
|
35247
|
35248
|
35249
|
35250
|
35251
|
35252
|
35253