From 40ddafa172a1ad6437399d6a3603f149dfcfc42c Mon Sep 17 00:00:00 2001 From: pines Date: Wed, 29 Nov 2006 01:35:20 +0000 Subject: [PATCH] unicode escaping is now happy! git-svn-id: svn://svn.open-ils.org/ILS/trunk@6629 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/cat/marcedit.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 062c95b8bb..518b93e7b7 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -63,6 +63,13 @@ function createControlField (tag,data) { return cf; } +function xml_escape_unicode ( str ) { + return str.replace( + /([\u0080-\ufffe])/g, + function (r,s) { return "&#x" + s.charCodeAt(0).toString(16) + ";"; } + ); +} + function my_init() { try { // Fake xulG for standalone... @@ -87,12 +94,8 @@ function my_init() { document.getElementById('save-button').setAttribute('label', window.xulG.save.label); document.getElementById('save-button').setAttribute('oncommand', 'mangle_005(); ' + - 'var xml_string = xml_record.toXMLString(); ' + - 'xml_string = xml_string.replace( ' + - ' /([\\u0080-\\ufffe])/g, ' + - ' function (r,s) { return "&#x" + s.charCodeAt(0).toString(16) + ";" } ' + - '); ' + - 'window.xulG.save.func( xml_record ); ' + + 'var xml_string = xml_escape_unicode( xml_record.toXMLString() ); ' + + 'window.xulG.save.func( xml_string ); ' + 'loadRecord(xml_record);' ); -- 2.11.0