UTF-8 text (Hindi) not getting displayed on Browser window or Eclipse console

But when I print it on eclipse console or on the browser screen I get only ???? ?? ??

As to Eclipse part, you need to tell it to use UTF-8 for its stdout console. You can set that by Window > Preferences > General > Workspace > Text File Encoding.

enter image description here

As to the JSP part, you need to tell it to use UTF-8 to write HTTP response body. You can set that by either

<%@page pageEncoding="UTF-8"%>

in every individual JSP, or applicationwide by

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

in web.xml.

See also:

Leave a Comment