php - Issue with utf-8 string on url when I send via form get method -
I have a form that needs to send the UTF-8 string parameters.
& lt; Form relay = "search" action = "/ archives" method = "get" & gt; & Lt; input name = "key" type = "text" value = "تست" /> & Lt; Input type = "submit" value = "submit" /> & Lt; / Form & gt; but changes to the URL
http: // localhost / archives? Key =% 26% 231578% 3B% 26% 231587% 3b% 26% 231578% 3B And the value of this criterion is incorrect in the destination: * 3 * Is there a way to encode these URLs in this way: http: // localhost / archives? Key = تست Because if I http: // localhost / archives? Key = تست In my browser, the value of this criterion is correct in the destination ... even the URL has a coded signage
The URL changes you are seeing are quite common: the browser needs a request to create a valid URL query string. PHP automatically decodes all the parameters, so you do not need to pay attention to it.
First of all: Are your HTML charsets set correctly on UTF-8?
html5:
& lt; Meta charset = "utf-8" & gt; Other html:
& lt; meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; Also on XHTML:
Second: Your web server is serving UTF-8? Is there a browser to install UTF-8 encoding on the request received?
On Apache, you can set encoding at httpd.conf:
AddDefaultCharset utf-8 In addition, you You can set the header on the PHP:
header ("content-type: text / html; charset = UTF-8"); You can get a request to use the Networks tab on the content type header of the supported document and on the Developer Tool (ctrl + shift + i on Chrome)
P>
Comments
Post a Comment