www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit c9003f1f40c27948ee5e548c889c2d1ac7f6bfd1
parent cb1446fdea67241fe982ecf7d957544c7544d239
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun,  1 Aug 2010 19:53:08 +0000

closes #1706, [PATCH] Item with non-ASCII characters corrupted on save when Show Editor is open

The problem here was that entities weren't properly being encoded as Unicode RTF when the editor was used, because TinyMCE was replacing high characters with HTML entities that were not properly decoded. This is now fixed.


Diffstat:
Mchrome/content/zotero/bindings/styled-textbox.xml | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml @@ -76,7 +76,6 @@ this._htmlToRtfMap = [ [/"(\w)/, "“$1"], [/([\w,.?!])"/, "$1”"], - [/[\x7F-\uFFFF]/g, function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+" " }], ["<p>", ""], ["</p>", "\\par "], [/<\/?div[^>]*>/g, ""], @@ -179,6 +178,7 @@ <!-- Sets or returns contents of rich text box --> <property name="value"> <getter><![CDATA[ + const highcharRe = /[\x7F-\uFFFF]/g; var output = this._editor.getContent(); if(this._format == "RTF") { @@ -213,9 +213,12 @@ for each(var entry in this._htmlToRtfMap) { output = output.replace(entry[0], entry[1], "g"); } - output = Zotero.Utilities.prototype.trim(output); - output = output.replace(" ", "&nbsp;", "g"); - output = Zotero.Utilities.prototype.unescapeHTML(output); + output = Zotero.Utilities.prototype.trim(output) + output = Zotero.Utilities.prototype.unescapeHTML( + output.replace(" ", "&nbsp;", "g")) + .replace(highcharRe, + function(aChar) { return "\\uc0\\u"+aChar.charCodeAt(0).toString()+" " }); + if(output.substr(-4) == "\\par") output = output.substr(0, output.length-4); }