Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, your JSP page is using UTF-8 character encoding.</p> <pre><code>&lt;%@ page ... pageEncoding="UTF-8"%&gt; </code></pre> <p>However, your Java code isn't using the same character encoding.</p> <pre><code>DataOutputStream wr; try { wr = new DataOutputStream(connection.getOutputStream ()); wr.writeBytes(urlParameters); // &lt;--- Wrong! Uses platform default encoding. wr.flush(); </code></pre> <p>You need to replace that troublesome piece by</p> <pre><code>try { connection.getOutputStream().write(urlParameters.getBytes("UTF-8")); </code></pre> <p>Note that the whole <code>DataOutputStream</code> decoration is unnecessary. It serves an entirely different purpose (namely writing of <code>.dat</code> type files). Don't forget to specify the same charset in the way how you've set your <code>Content-Length</code> header.</p> <hr> <p>Second, the parameter names/values themselves should be URL-encoded in order to be extracted properly form the HTTP request.</p> <pre><code>String urlParameters = "t=" + URLEncoder.encode("выыававыавыавыавфыа", "UTF-8") + "&amp;l=" + URLEncoder.encode("a", "UTF-8"); </code></pre> <hr> <p>Third, your request headers are actually also wrong:</p> <pre><code>connection.setRequestProperty("Content-Type", "text/html"); connection.setRequestProperty("charset", "utf-8"); </code></pre> <p>You aren't sending <code>text/html</code> data at all. You are sending <code>application/x-www-form-urlencoded</code> data. Also, that <code>charset</code> should have been an attribute of the <code>Content-Type</code> header, thus so:</p> <pre><code>connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); </code></pre> <h3>See also:</h3> <ul> <li><a href="https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests">Using java.net.URLConnection to fire and handle HTTP requests</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload