Hey folks,
I'm working on removing the following pending comments from
c.s.f.util.HtmlUtils:
// Double-byte characters to encode.
// PENDING: when outputting to an encoding that
// supports double-byte characters (UTF-8, for example),
// we should not be encoding
_writeDecRef(out, ch)
I've come up with:
/**
* @param encoding a valid encoding
* @return <code>true</code> if the specified encoding is
* multi-byte, otherwise <code>false</code>
*/
static public boolean isEncodingMultiByte(String encoding) {
Charset c = Charset.forName(encoding);
return (c.newEncoder().maxBytesPerChar() > 1.0f);
}
Just curious if anyone had ideas on a better way to handle this detection.