int (String text, int escapeStart, @NonNls StringBuilder out) { final int textLength = text.length(); int length = 1; boolean zeroToThree = false; while (escapeStart + length <= textLength) { final char c = escapeStart + length == textLength ? 0 : text.charAt(escapeStart + length); if (length == 1 && (c == '0' || c == '1' || c == '2' || c == '3')) { zeroToThree = true; } if (c < '0' || c > '7' || length > 3 || (length > 2 && !zeroToThree)) { final int ch = Integer.parseInt(text.substring(escapeStart + 1, escapeStart + length), 8); out.append("\\u").append(String.format("%04x", Integer.valueOf(ch))); break; } length++; } return escapeStart + length; }