code: public static String decode_escaped(String str) {
  		if(str.indexOf('\\')==-1)
  			return str;
  		StringBuilder sb=new StringBuilder(str.length());
  		for(int i=0; i<str.length(); ++i) {
  			char c=str.charAt(i);
  			if(c=='\\') {
  				// possible escape sequence
  				char c2=str.charAt(++i);
  				switch(c2) {
  					case '\\':
  						// double-escaped '\\'--> '\'
  						sb.append(c);
  						break;
  					case 'x':
  						// hex escaped "\x??"
  						char h1=str.charAt(++i);
  						char h2=str.charAt(++i);
  						c2=(char)Integer.parseInt(""+h1+h2, 16);
  						sb.append(c2);
  						break;
  					case 'n':
  						sb.append('\n');
  						break;
  					case 'r':
  						sb.append('\r');
  						break;
  					case 't':
  						sb.append('\t');
  						break;
  					case '\'':
  						sb.append('\'');		// sometimes occurs in protocol level 0 strings
  						break;
  					default:
  						if(str.length()>80)
  							str=str.substring(0, 80);
  						throw new PickleException("invalid escape sequence char \'"+ (c2) + "\' in string \"" + str + " [...]\" (possibly truncated)");
  				}
  			} else {
  				sb.append(str.charAt(i));
  			}
  		}
          return sb.toString();
  	}
docs: Decode a string with possible escaped char sequences in it (\x??).