Home >Web Front-end >JS Tutorial >js transfers value to action through the address bar (Chinese garbled characters are all question marks)_javascript skills
A few days ago, I encountered a small problem while completing an ssh framework project. The situation is like this.
Private variables are defined in the action and provide get() and set() methods, which should be accessible in js code. So I passed the value from the js code to the corresponding variable of the action through the address bar. However, if the variable value is Chinese, the test output in the action is "???", but it can still be displayed in the browser address bar. Chinese.
I first configured the tomcat configuration file based on some answers online, but to no avail. Later, I thought about it, maybe it wasn't a complicated problem, it was probably an encoding problem. The encoding of my myeclipse and project are both set to "UTF-8". So I tried to set both the project and myeclipse encoding to "iso8859-1", but it still didn't work.
This didn’t work, so I took a more direct approach and tried converting the obtained variable value in the action (assuming the variable is a string):