How is the coding in the java.net.URLEncoder.encode method determined?

in java.net.URLEncoder The

public static String encode (String s, String enc) method, where the enc (character encoding name) determines which character set to use?
after encoding according to the relevant character set, how can I send it to IE,IE to know which character set to use for decoding?

May.23,2022

its function is to convert the character s you enter into the byte [] of the enc encoding format (utf-8 is recommended in jdk) and then convert the corresponding URL encoding characters
the browser itself can parse these URL codes
clipboard.png


1. Confirm what encoding format your WEB container will choose. Take Tomcat as an example, modify the conf/server.xml file under tomcat, as follows:

    <Connector port="8080" useBodyEncodingForURI="true" protocol="HTTP/1.1"
        URIEncoding="UTF-8"
        protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="8443" />

2. Confirm which encoding format your front-end page chooses

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59f48-45584.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59f48-45584.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?