}
// Select the best charset that we could find from the accept headers.
EncodingManager encodingManager = appContext.getEncodingManager();
AcceptCharsetSelector selector = new AcceptCharsetSelector(
encodingManager);
HttpHeaders rHeaders = HttpFactory.getDefaultInstance()
.createHTTPHeaders();
String charset = selector.selectCharset(rHeaders,
(DefaultDevice) context.getDevice().getDevice());
if (charset != null) {
// Use the selected charset.
// This should always succeed since we already validated it.
setCharacterEncoding(charset);