[open-ils-commits] [GIT] Evergreen ILS branch rel_2_12 updated. a44049502364f851d52b9dec9cac99270ca2fede
Evergreen Git
git at git.evergreen-ils.org
Wed May 17 13:43:58 EDT 2017
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, rel_2_12 has been updated
via a44049502364f851d52b9dec9cac99270ca2fede (commit)
from baf94caad1df88ccda10f5fc1092c4ad8302ead4 (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 a44049502364f851d52b9dec9cac99270ca2fede
Author: Galen Charlton <gmc at esilibrary.com>
Date: Fri Nov 11 14:52:11 2016 -0500
LP#1641208: util.file no longer mangles UTF8 when writing JSON
This patch ensures that JSON strings are converted to UTF8
before they are writing to XUL profile files by util.file. Doing this
fixes a bug where by OU names like "ბიზნესისა" can get mangled
in certain XUL client interfaces.
To test
-------
[1] Set an OU name to ბიზნესისა
[2] In the transit list, note that the OU selector displays
the name as ÑØÖÜÔáØáÐ.
[3] Apply the patch (note that it's not necessary to rebuild
the staff client to test this).
[4] Restart the staff client, clearing cache beforehand.
[5] Note that the OU name is now displayed correctly in the transit
list.
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
diff --git a/Open-ILS/xul/staff_client/chrome/content/util/file.js b/Open-ILS/xul/staff_client/chrome/content/util/file.js
index bc696dd..857f32f 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/file.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/file.js
@@ -103,7 +103,12 @@ util.file.prototype = {
var obj_json;
try { obj_json = js2JSON( obj ) + '\n'; } catch(E) { throw('Could not JSONify the object: ' + E); }
- this.write_content(write_type,obj_json);
+ var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ converter.charset = "UTF-8";
+ var converted = converter.ConvertFromUnicode(obj_json);
+
+ this.write_content(write_type,converted);
} catch(E) {
this.error.sdump('D_ERROR',this._file.path + '\nutil.file.write_object(): ' + E);
@@ -126,7 +131,11 @@ util.file.prototype = {
'get_object' : function() {
try {
var data = this.get_content();
- var obj; try { obj = JSON2js( data ); } catch(E) { throw('Could not js-ify the JSON: '+E); }
+ var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ converter.charset = "UTF-8";
+ var converted = converter.ConvertToUnicode(data);
+ var obj; try { obj = JSON2js( converted ); } catch(E) { throw('Could not js-ify the JSON: '+E); }
return obj;
} catch(E) {
this.error.sdump('D_ERROR',this._file.path + '\nutil.file.get_object(): ' + E);
-----------------------------------------------------------------------
Summary of changes:
.../xul/staff_client/chrome/content/util/file.js | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list