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

git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@476469 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David E. Jones
2006-11-18 08:30:52 +00:00
parent 198ec634df
commit 5db56d8d2c
@@ -1052,6 +1052,13 @@ public class GenericEntity extends Observable implements Map, LocalizedMap, Seri
// 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);
}
}
}