private static String escape(String source) {
    if (source == null) {
      return "";
    }
    return source.replace("|", "||").replace("\n", "|n").replace("\r", "|r").replace("'", "|'").replace("]", "|]");
  }
private static String escape(String source)