Utils { public static String decodeApacheHTTPDLogValue(String input){ if (input == null || input.length() == 0) { return input; } if (!input.contains("\\")) { return input; } StringBuilder sb = new StringBuilder(input.length()); for (int i = 0; i < input.length(); i++) { char chr = input.charAt(i); if (chr == '\\') { chr = input.charAt(++i); switch (chr){ case '"': case '\\': sb.append(chr); break; case 'b': sb.append('\b'); break; case 'n': sb.append('\n'); break; case 'r': sb.append('\r'); break; case 't': sb.append('\t'); break; case 'v': sb.append((char)hexCharsToByte('0', 'b')); break; case 'x': char chr1 = input.charAt(++i); char chr2 = input.charAt(++i); sb.append((char)hexCharsToByte(chr1, chr2)); break; default: sb.append('\\').append(chr); } } else { sb.append(chr); } } return sb.toString(); } private  Utils(); static String resilientUrlDecode(String input); static byte hexCharsToByte(String twoHexDigits); static byte hexCharsToByte(char c1, char c2); static String decodeApacheHTTPDLogValue(String input); static String makeHTMLEncodedInert(String uriString); static String replaceString(
        final String input,
        final String searchFor,
        final String replaceWith
    );  }
@Test public void testApacheLogDecoder() { assertEquals("bla bla bla", Utils.decodeApacheHTTPDLogValue("bla bla bla")); assertEquals("bla bla bla", Utils.decodeApacheHTTPDLogValue("bla\\x20bla bla")); assertEquals("bla\bbla\nbla\tbla", Utils.decodeApacheHTTPDLogValue("bla\\bbla\\nbla\\tbla")); assertEquals("bla\"bla\nbla\tbla", Utils.decodeApacheHTTPDLogValue("bla\\\"bla\\nbla\\tbla")); assertEquals(new String(new byte[] {(byte)0x0b}), Utils.decodeApacheHTTPDLogValue("\\v")); assertEquals("\\q", Utils.decodeApacheHTTPDLogValue("\\q")); assertEquals("", Utils.decodeApacheHTTPDLogValue("")); assertEquals(null, Utils.decodeApacheHTTPDLogValue(null)); }