title: Getting ?????? instead of Hindi text from MySQL database using JSP
body: <p>I am getting ?????? instead of Hindi text from MySQL database using JSP.</p>
  
  <p>Here is my JSP code:  </p>
  
  <pre><code>&lt;html&gt; 
       &lt;head&gt; 
       &lt;title&gt;display data from the table using jsp&lt;/title&gt; 
      &lt;/head&gt; 
      &lt;body&gt; 
      &lt;h2&gt;Data from the table 'stu_info' of database 'student'&lt;/h2&gt; 
      &lt;% 
      try { 
  
      String connectionURL = "jdbc:mysql://localhost:3306/student"; 
  
      Connection connection = null; 
  
      Statement statement = null; 
  
      ResultSet rs = null; 
      Class.forName("com.mysql.jdbc.Driver").newInstance(); 
      connection = DriverManager.getConnection(connectionURL, "root", "root"); 
      statement = connection.createStatement(); 
  
      String QueryString = "SELECT * from stu_info"; 
      rs = statement.executeQuery(QueryString); 
      %&gt; 
      &lt;TABLE cellpadding="15" border="1" style="background-color: #ffffcc;"&gt; 
      &lt;% 
      while (rs.next()) { 
      %&gt; 
      &lt;TR&gt; 
      &lt;TD&gt;&lt;%=rs.getInt(1)%&gt;&lt;/TD&gt; 
      &lt;TD&gt;&lt;%=rs.getString(2)%&gt;&lt;/TD&gt; 
      &lt;TD&gt;&lt;%=rs.getString(3)%&gt;&lt;/TD&gt; 
      &lt;TD&gt;&lt;%=rs.getString(4)%&gt;&lt;/TD&gt; 
      &lt;/TR&gt; 
      &lt;% } %&gt; 
      &lt;% 
      // close all the connections. 
      rs.close(); 
      statement.close(); 
      connection.close(); 
      } catch (Exception ex) { 
      %&gt; 
       &lt;/font&gt; 
      &lt;font size="+3" color="red"&gt;&lt;/b&gt; 
      &lt;% 
      out.println("Unable to connect to database."); 
      } 
      %&gt; 
      &lt;/TABLE&gt;&lt;TABLE&gt; 
      &lt;TR&gt; 
      &lt;TD&gt;&lt;FORM ACTION="welcome_to_database_query.jsp" method="get" &gt; 
      &lt;button type="submit"&gt;&lt;-- back&lt;/button&gt;&lt;/TD&gt; 
      &lt;/TR&gt; 
      &lt;/TABLE&gt; 
      &lt;/font&gt; 
      &lt;/body&gt; 
      &lt;/html&gt;
  </code></pre>
  
  <p>Three columns of English text are displayed correct. For the Hindi column I have used collation <code>utf-general_ci</code>, but when I print <code>rs.getString(4)</code> it gives me <code>???????</code>. My browser also supports UTF-8. How is this problem caused and how can I solve it?</p>