private static int decode(String input, int offset, StringBuilder output) {
        char c = 0;
        int end = offset;
        int start = offset + 1;
        int codePoint;

        while ('}' != c) {
            if (++end >= input.length()) {
                throw new IllegalArgumentException("Unterminated quoted character or empty quoting.");
            }
            c = input.charAt(end);
        }
        try {
            codePoint = Integer.parseInt(input.substring(start, end), 16);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Unexpected quoted data: [" + input.substring(start, end) + "]", e);
        }
        if (Character.charCount(codePoint) > 1) {
            try {
                output.append(Character.toChars(codePoint));
            } catch (IllegalArgumentException e) {
                throw new IllegalArgumentException("Unexpected quoted data: [" + input.substring(start, end) + "]", e);
            }
        } else {
            output.append((char) codePoint);
        }
        return end;

    }
ISO 646.irv:1991 safe unquoting into a StringBuilder instance.

@param input the string to decode
@param output the destination buffer
@return the destination buffer given as input
@throws IllegalArgumentException if the input string contains unexpected or invalid data
vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/Encoder.java