Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在网站中显示土耳其字符。Tomcat服务器,Mysql数据库_Java_Mysql_Tomcat_Encoding_Tomcat7 - Fatal编程技术网

Java 无法在网站中显示土耳其字符。Tomcat服务器,Mysql数据库

Java 无法在网站中显示土耳其字符。Tomcat服务器,Mysql数据库,java,mysql,tomcat,encoding,tomcat7,Java,Mysql,Tomcat,Encoding,Tomcat7,土耳其语字符显示为“?”并错误地插入了数据库。 我可以在phpmyadmin中更改文本,并再次将其设置为土耳其语。通过这种方式,一切都很完美 我的编码过滤器: private String encoding; public void init(FilterConfig config) throws ServletException { encoding = config.getInitParameter("requestEncoding"); if (encoding ==

土耳其语字符显示为“?”并错误地插入了数据库。 我可以在phpmyadmin中更改文本,并再次将其设置为土耳其语。通过这种方式,一切都很完美

我的编码过滤器:

private String encoding;

public void init(FilterConfig config) throws ServletException {
    encoding = config.getInitParameter("requestEncoding");

    if (encoding == null)
        encoding = "UTF-8";
}

public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain next) throws IOException, ServletException {
    // Respect the client-specified character encoding
    // (see HTTP specification section 3.4.1)
    if (null == request.getCharacterEncoding())
        request.setCharacterEncoding(encoding);

    /**
     * Set the default response content type and encoding
     */
    response.setContentType("text/html; charset=UTF-8");
    response.setCharacterEncoding("UTF-8");

    next.doFilter(request, response);
}

public void destroy() {
}

我在localhost中没有土耳其语字符问题。我只在www.gurkanilleez.com中看到问题。

每个非英语字符都有问号?可能发生的情况:

  • 您有utf8编码的数据(良好)
  • SET NAMES拉丁语1
    已生效(默认,但错误)
  • 列被声明为
    字符集latin1
    (默认值,但错误)
使用utf8而不是拉丁语1

对于JDBC,在getConnection()调用中包括
?useUnicode=yes&characterEncoding=UTF-8


stackoverflow中有几个关于土耳其字符集问题的线程;阅读它们。

由于我的声誉,我不能发表评论。我访问了你的网站,我看到了土耳其语字符,因为他们应该是。所以,没有问题,或者?

我正在使用Hibernate。我尝试了您的解决方案,但没有任何效果将输入字段发送到数据库时出现问题。我解决了jdbc的问题:mysql://localhost:3306/dbname?characterEncoding=UTF-8只需附加“characterEncoding=UTF-8”