java 从oracl读取数据时候乱码了,原因之一就是数据库所使用的字符编码是merican_America.US7Ascii
发布网友
发布时间:2022-05-15 08:27
我来回答
共2个回答
热心网友
时间:2023-10-15 16:13
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class CharEncodingFilter implements Filter {
public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
chain.doFilter(request, response);
}
public void init(FilterConfig arg0) throws ServletException {
}
}
热心网友
时间:2023-10-15 16:13
可以尝试编写一个编码转换类,看看是个什么样 。