下面用于设置字符流输出文本采用UTF-8编码的选项中,正确的是( )
A: response.setEncoding("utf-8");
B: response.setCharacter ("utf-8");
C: response.setCharacterEncoding("utf-8");
D: request.setCharacterEncoding("utf-8");
A: response.setEncoding("utf-8");
B: response.setCharacter ("utf-8");
C: response.setCharacterEncoding("utf-8");
D: request.setCharacterEncoding("utf-8");
举一反三
- 下面用于设置字符流输出文本采用UTF-8编码的选项中,正确的是( )
- 调用响应对象response的setCharacterEncoding()方法设置响应的字符编码,如utf-8。如果没有指定响应的字符编码,PrintWriter将使用iso-8859-1编码
- 下面选项中,用于设置浏览器显示文本采用UTF-8编码的是 A: response.setHeader("Content-Type","charset=utf-8"); B: request.setHeader("Content-Type","charset=utf-8"); C: request.setHeader("Content-Type","text/html;charset=utf-8"); D: response.setHeader("Content-Type","text/html;charset=utf-8");
- 在JSP中,假设表单的method="post",在发送请求时中文乱码处理的正确做法是( )。 A: request.setCharacterEncoding("utf-8"); B: response.setCharacter("utf-8"); C: request.setContentType("text/html;charset=utf-8"); D: response.setContentType("text/html;charset=utf-8");
- 用户使用POST方式提交的数据中存在汉字(使用utf-8字符集),在Servlet中需要使用下述______语句处理。 A: request.setCharacterEncoding("utf-8); B: request.setContentType("text/html;charset=utf-8"); C: response.setCharacterEncoding("utf-8"); D: response.setContentType("text/html;charset=utf-8");