Author: jleroux
Date: Wed Jul 29 11:50:41 2015
New Revision: 1693242
URL:
http://svn.apache.org/r1693242Log:
Fixes an issue crossed while checking OFBIZ-6504 - how to Create PDF with password Protected in Ofbiz
When a description used in a drop-down comes from a localised label in CommonEntityLabels.xml and contains a single quote (') this single quote must be escaped to allow the rendering. Else it's a single quote inside 2 single quotes for the option like:
{'key':'EXST_CANCELLED','description':'Annuler l'exemple (En projet)'}
with he percent encoding there is no issue:
{'key':'EXST_CANCELLED','description':'Annuler l%27exemple (En projet)'}
We noted, with Jinghai, that using html entities does not work. I guess due to another encoding further in the chain. I also tried to percent encoding but was unable to find how to replace a % in Freemarker. Thanks to Gareth's suggestion I finally escaped the quote. Also to escape the quote with replaceAll() in Java you have to put 5 \, small but weird issues ;) I hope nothing else somewhere already escape the quote, we will see anyway...
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1693242&r1=1693241&r2=1693242&view=diff==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java Wed Jul 29 11:50:41 2015
@@ -849,7 +849,7 @@ public final class MacroFormRenderer imp
if (textSize > 0 && description.length() > textSize) {
description = description.substring(0, textSize - 8) + "..." + description.substring(description.length() - 5);
}
- options.append(encode(description, modelFormField, context));
+ options.append(encode(description.replaceAll("'", "\\\\\'"), modelFormField, context));
if (UtilValidate.isNotEmpty(currentValueList)) {
options.append("'");