title: How to print Hindi text into web page by giving servlet , java and html code
body: <p>i am using servlet, java and one html code to extract hindi text from following URL : <a href="https://hi.wikipedia.org/wiki/%E0%A4%B5%E0%A4%BE%E0%A4%B0%E0%A4%BE%E0%A4%A3%E0%A4%B8%E0%A5%80" rel="nofollow noreferrer">https://hi.wikipedia.org/wiki/%E0%A4%B5%E0%A4%BE%E0%A4%B0%E0%A4%BE%E0%A4%A3%E0%A4%B8%E0%A5%80</a></p>
  
  <p>i want to display hindi font by servlet code , code is given as :</p>
  
  <pre><code>//Extraction1.java //java file
  import java.io.IOException;
  import java.net.URL;
  import java.util.Scanner;
  
  public class Extraction1 {
  
   public String toHtmlString(String url) throws IOException 
  {
    StringBuilder sb = new StringBuilder();
    for(Scanner sc = new Scanner(new URL(url).openStream()); sc.hasNext(); )
    sb.append(sc.nextLine()).append('\n');
    return sb.toString();
   }
  }
  </code></pre>
  
  <p>MultiParamServlet3.java // servlet file</p>
  
  <pre><code>import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  public class MultiParamServlet3 extends HttpServlet
  {
    private static final long serialVersionUID = 1L;
  
    public void doPost(HttpServletRequest req,HttpServletResponse resp) throws          ServletException,IOException
  {
    PrintWriter pw=resp.getWriter();
  
     resp.setContentType("text/html");
  
     String[] values=req.getParameterValues("habits");
  
     Extraction1 t=new Extraction1();
     String s=t.toHtmlString(values[0]).replaceAll("\\&lt;.*?&gt;","");
     pw.println("&lt;html&gt;&lt;head&gt;&lt;meta charset=\"utf-8\"&gt;&lt;/head&gt;&lt;body&gt;"+s+"&lt;/body&gt;&lt;/html&gt;");
  
    pw.close(); 
   }
  }
  </code></pre>
  
  <p>index.html // html file</p>
  
  <pre><code>  &lt;!DOCTYPE html&gt;
    &lt;html&gt;
    &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Insert title here&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;form method="Post" action="MultiParamServlet3"&gt;
    &lt;Label&gt; &lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;      &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;n bsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter    the URL : &lt;/label&gt;
    &lt;input name='habits' id='t2'&gt;
    &lt;input type="submit" name="submit"&gt; 
   &lt;/form&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>servlet program able to print english text after extraction, but hindi text converted as ????? (question mark).</p>
  
  <p>how to print hindi text into web page by servlet program ?</p>