aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/utils/XmlHelper.java
blob: 9e062f0daa58395cc04affd9056e39ccb66c63de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
package eu.siacs.conversations.utils;

public class XmlHelper {
	public static String encodeEntities(String content) {
		content = content.replace("&", "&");
		content = content.replace("<", "&lt;");
		content = content.replace(">", "&gt;");
		content = content.replace("\"", "&quot;");
		content = content.replace("'", "&apos;");
		content = content.replaceAll("[\\p{Cntrl}&&[^\n\t\r]]", "");
		return content;
	}
}