Author: jonesde
Date: Sat Nov 18 00:30:52 2006
New Revision: 476469
URL:
http://svn.apache.org/viewvc?view=rev&rev=476469Log:
Applied patch from Fabian Gorsler to escape certain characters to avoid problems in the XML export/import; changed to not use the codePointAt method because it is only supported in Java 5; Jira #OFBIZ-453
Modified:
incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
Modified: incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?view=diff&rev=476469&r1=476468&r2=476469==============================================================================
--- incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ incubator/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Sat Nov 18 00:30:52 2006
@@ -1052,6 +1052,13 @@
// if it is less that 0x20 at this point it is invalid because the only valid values < 0x20 are 0x9, 0xA, 0xD as caught above
Debug.logInfo("Removing invalid character [" + curChar + "] numeric value [" + (int) curChar + "] for field " + name + " of entity with PK: " + this.getPrimaryKey().toString(), module);
value.deleteCharAt(i);
+ }else if(curChar > 0x7F) {
+ // Replace each char which is out of the ASCII range with a XML entity
+ String replacement = "&#" + (int) curChar + ";";
+ if(Debug.verboseOn()) {
+ Debug.logVerbose("Entity: "+ this.getEntityName() +", PK: " + this.getPrimaryKey().toString() +" -> char ["+ curChar +"] replaced with ["+ replacement +"]", module);
+ }
+ value.replace(i, i+1, replacement);
}
}
}