Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSP giving page with question marks for russian text

I am implementing JSP page, where from database I get some list and showing it in JSP using jquery-ui autocomplete combobox:

 <div class="ui-widget">
        <label>Select MKB from list: </label>
        <select id="combobox">
            <option value=""></option>
            <c:forEach var="mkb" items="${mkbList}">
                <option value="${mkb.id}"><c:out value="${mkb.mkbText}"/></option>
            </c:forEach>
        </select>
    </div>

And the problem is that the values in the combo box are all in question marks when loading page in browser (russian characters expected).

In the same jsp file I am including header.jsp, where there is the following line:

<%@page contentType="text/html; UTF-8" pageEncoding="UTF-8"%>

So the encoding should be fine. The encoding of source file is also in UTF-8 In jsp file there is also line:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

I am using tomcat8 and Java 7. One more thing I have tried is adding: -Dfile.encoding=UTF-8 to the startup parameters of tomcat.

The Servlet itself is doing the following:

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    MkbDAO mkbDAO = new MkbDAO();
    List<MKB> mkbList = mkbDAO.getMKBList();
    request.setAttribute("mkbList", mkbList);
    RequestDispatcher rd = getServletConfig().getServletContext().getRequestDispatcher("/WEB-INF/jsp/diagList.jsp");
    rd.include(request, response);
}

I was debugging that servlet code, and looked at values in debugger watch window, and values of the list were shown in correct russian characters.

Could you help with resolving this issue?

like image 787
maximus Avatar asked Mar 21 '14 07:03

maximus


1 Answers

Maybe it's a problem in your Tomcat configuration: see the Tomcat FAQ for possible solutions.

like image 196
mmjmanders Avatar answered Nov 18 '22 07:11

mmjmanders