private static boolean isSupportedCharset ( MediaType mediaType ) { Map < String , String > parameters = mediaType . getParameters ( ) ; if ( parameters == null || parameters . isEmpty ( ) ) { return true ; } String charset = parameters . get ( "charset" ) ; return charset == null || "UTF-8" . equalsIgnoreCase ( charset ) || "ISO-8859-1" . equalsIgnoreCase ( charset ) ; }
As content is cached we expect both ends use UTF - 8 always . If no content charset encoding is explicitly defined UTF - 8 is assumed as a default . As legacy clients may use ISO 8859 - 1 we accept it as well although result may be unspecified if characters out of ASCII 0 - 127 range are used .