Issue #2398 - MultiPart Charset Encoding

Improved comment describing charset behaviour for MultiPart

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2018-06-12 17:31:04 +10:00
parent 04c1447f88
commit 34351c7854
1 changed files with 10 additions and 5 deletions

View File

@ -2349,11 +2349,16 @@ public class Request implements HttpServletRequest
}
}
// charset should be:
// 1. the charset set in the parts content type; else
// 2. the default charset set in the _charset_ part; else
// 3. the default charset set in the request.setCharacterEncoding; else
// 4. the default charset set to UTF_8
/*
Select Charset to use for this part. (NOTE: charset behavior is for the part value only and not the part header/field names)
1. Use the part specific charset as provided in that part's Content-Type header; else
2. Use the overall default charset. Determined by:
a. if part name _charset_ exists, use that part's value.
b. if the request.getCharacterEncoding() returns a value, use that.
(note, this can be either from the charset field on the request Content-Type
header, or from a manual call to request.setCharacterEncoding())
c. use utf-8.
*/
Charset defaultCharset;
if (_charset_ != null)
defaultCharset = Charset.forName(_charset_);