When the code is implemented, some characters cannot be decoded. I am getting a bunch of question marks like ??. How can I fix this?
HtmlInput inputBox2 = (HtmlInput)currentPage.getHtmlElementById("classNo");
inputBox2.setValueAttribute("2016同學15");
ScriptResult result = currentPage.executeJavaScript("javascript:Search(2)");
I found this in the compiler: ScriptResult[result=net.sourceforge.htmlunit.corejs.javascript.Undefined@24d7aac3 page=HtmlPage(http://www.xx.org/classNo=2016??15)@1330510442]
You might try to use URL-encoding for some ASCII and all non ASCII characters.
e.g. space by %20
Here is a web site explaning the HTML URL Encoding Reference. You can also interactive encode strings there.
Your "2016同學15" would be encoded as: "2016%E5%90%8C%E5%AD%B815"