Details
Description
Affects 8.1.2 and possibly later, didn't check.
Set the platform encoding to -Dfile.encoding=UTF-16 (I'm dodging the question if this is a valid configuration for now). This reveals bugs with dependencies on default platform encoding, for example HTTP's content-type/ charset is decoded via call to MimeTypes#getCharsetFromContentType(Buffer) where it traverses the buffer assuming it is US-ASCII (which makes sense), but then does:
return CACHE.lookup(value.peek(start,i-start)).toString();
This is repeated in two places. Buffer's default toString() uses platform encoding so this will be screwed up if the content's US-ASCII characters don't align perfectly with it (ebcdic, UTF-16, etc.).
There is no workaround. A fix is to decode with US-ASCII as HTTP headers should be in this encoding.
Hi David,
I've fixed those, thanks. You mention it occurs in other places, do you have a list of them?
thanks
Jan