Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * In addition to escaping certain XML characters, we need to replace a carriage return + a line feed, because when * it's read back in, only the line feed is preserved. But flexrep isn't happy with the multipart data unless the * carriage returns are there as well. * * @param body * @return */ public static String escapeBody(String body) { body = body.replace("<", "<"); body = body.replace(">", ">"); body = body.replace("\r\n", "CARRIAGERETURN\n"); return body; } }