[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0ad4dd6d7f856dbc5ccf6bce5f3ab74d13898396

Evergreen Git git at git.evergreen-ils.org
Tue Dec 18 00:44:56 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  0ad4dd6d7f856dbc5ccf6bce5f3ab74d13898396 (commit)
      from  5134977a87331b39dd4db0c1dae4386bdbfc9664 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0ad4dd6d7f856dbc5ccf6bce5f3ab74d13898396
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Tue Nov 6 16:32:23 2012 -0500

    Fix foreign character display in receipts
    
    This commit makes two changes to the staff client print code to
    help with the proper display of foreign characters:
    
    1) Specify the utf-8 charset in the receipt Data URIs.
    2) Properly encode the entire data string using encodeURIComponent
    rather than encode().  Failing to do so was causing XULRunner to
    be "creative" with the interpretation of the data.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js
index 45cd623..61672ec 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/print.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js
@@ -175,13 +175,14 @@ util.print.prototype = {
                             my_prefix = xulG.url_prefix(my_prefix);
                         }
                     }
-                    var print_url = 'data:text/html,<html id="top"><head>'
+                    var print_url = '<html id="top"><head>'
                         + '<script src="' + my_prefix + 'util/print_win.js"></script>'
                         + '<script src="' + my_prefix + 'util/print_custom.js"></script>';
                     if(this.data.hash.aous['print.custom_js_file']) {
                         print_url += '<script src="' + this.data.hash.aous['print.custom_js_file'] + '"></script>';
                     }
-                    print_url += '</head><body onload="try{print_init(\'' + params.type + '\');}catch(E){alert(E);}">' + window.escape(msg.replace(/<script[^>]*>.*?<\/script>/gi,'')) + '</body></html>';
+                    print_url += '</head><body onload="try{print_init(\'' + params.type + '\');}catch(E){alert(E);}">' + msg.replace(/<script[^>]*>.*?<\/script>/gi,'') + '</body></html>';
+                    print_url = 'data:text/html;charset=utf-8,' + encodeURIComponent(print_url);
                     obj.win.openDialog(print_url,'receipt_temp','chrome,resizable,modal', { "data" : params.data, "list" : params.list}, function(w) { 
                         try {
                             obj.NSPrint(w, silent, params);
@@ -295,8 +296,8 @@ util.print.prototype = {
         s=s.replace(/onload\s*=\s*'[^']*'/gi,'');
 
         if (params.sample_frame) {
-            var jsrc = 'data:text/javascript,' + window.escape('var params = { "data" : ' + js2JSON(params.data) + ', "list" : ' + js2JSON(params.list) + '};');
-            params.sample_frame.setAttribute('src','data:text/html,<html id="top"><head><script src="' + window.escape(jsrc) + '"></script></head><body>' + window.escape(s) + '</body></html>');
+            var jsrc = 'data:text/javascript,' + encodeURIComponent('var params = { "data" : ' + js2JSON(params.data) + ', "list" : ' + js2JSON(params.list) + '};');
+            params.sample_frame.setAttribute('src','data:text/html;charset=utf-8,' + encodeURIComponent('<html id="top"><head><script src="' + jsrc + '"></script></head><body>' + s + '</body></html>'));
         } else {
             this.simple(s,params);
         }

-----------------------------------------------------------------------

Summary of changes:
 .../xul/staff_client/chrome/content/util/print.js  |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list