Q:

SpringBoot embedded tomcat server reads unicode character in query parameter as null

I have a rest end point designed in spring boot. Tomcat is being used as embedded server. It takes a query parameter. 

When I pass query parameter as param1%uFF07 tomcat internally reads parameter as null
When I pass query parameter as param1%FF07 tomcat reads as some character.

tomcat only reads '%' character when followed by two hexadecimal numbers, if u is placed after '%' character tomcat parse parameter as null with message 

Character decoding failed. Parameter [name] with value [param1%uFF07]
  has been ignored. Note that the name and value quoted here may be
  corrupted due to the failed decoding. Use debug level logging to see
  the original, non-corrupted values.  Note: further occurrences of
  Parameter errors will be logged at DEBUG level.

Here is spring boot controller code
@RestController
public class GreetingController {

    private static final String template = "Hello, %s!";
    private final AtomicLong counter = new AtomicLong();

    @RequestMapping("/greeting")
    public Greeting greeting(@RequestParam(value = "name", required = false) String name) {
        return new Greeting(counter.incrementAndGet(), String.format(template, name));
    }
}

A:

I found out a way using filters. Basics about filters could be found over here. We can intercept request query string there and use Tomcat UDecoder class to parse the query string and if any exception is thrown we can show response of 400
public class SimpleFilter implements Filter {
private final UDecoder urlDecoder = new UDecoder();
private final Logger logger = LoggerFactory.getLogger(SimpleFilter.class);

@Override
public void init(FilterConfig filterConfig) throws ServletException {
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    HttpServletRequest httpServletRequest = (HttpServletRequest) request;
    HttpServletResponse httpServletResponse = (HttpServletResponse) response;

    String queryString = httpServletRequest.getQueryString();
    if (queryString != null) {
        ByteChunk byteChunk = new ByteChunk();
        byteChunk.setBytes(queryString.getBytes(), 0, queryString.length());
        try {
            urlDecoder.convert(byteChunk, true);
        } catch (IOException ioException) {
            logger.error("Hazarduos character found in request parameter.");
            httpServletResponse.setStatus(HttpStatus.BAD_REQUEST.value());
            return;
        }
    }
    chain.doFilter(request, response);
}

@Override
public void destroy() {
}

}

