void (StringBuilder buffer, String str) { final int length = str.length(); for (int idx = 0; idx < length; idx++) { char ch = str.charAt(idx); if (ch == '/') { buffer.append("\\/"); } else if (Character.isISOControl(ch) && ch != '\n' || ch == '$') { appendUnicode(buffer, ch); } else { buffer.append(ch); } } }