Skip to content

Commit

Permalink
fix(plc4j/xmlWriter): don't print invalid xml chars
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Jan 21, 2022
1 parent 3bd1a67 commit 2c75a95
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public void writeBigDecimal(String logicalName, int bitLength, BigDecimal value,

@Override
public void writeString(String logicalName, int bitLength, String encoding, String value, WithWriterArgs... writerArgs) throws SerializationException {
createAndAppend(logicalName, rwStringKey, bitLength, value, encoding, writerArgs);
String cleanedUpString = StringUtils.trimToEmpty(value).replaceAll("[^\u0009\r\n\u0020-\uD7FF\uE000-\uFFFD\ud800\udc00-\udbff\udfff]", "");
createAndAppend(logicalName, rwStringKey, bitLength, cleanedUpString, encoding, writerArgs);
move(bitLength);
}

Expand Down

0 comments on commit 2c75a95

Please sign in to comment.