Home >Web Front-end >uni-app >How to solve the problem of garbled characters after uniapp submission
Solution to garbled characters after uniapp is submitted: 1. Encapsulate the value to be transmitted into an object at the front end and pass it to the back end; 2. In the back end, modify the receiving format to "@RequestBody", that is Just receive the json format.
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.
Recommended (free): uni-app development tutorial
##uni-app front-end get request is passed to the back-end Chinese value garbled problem
Record some garbled code problems encountered when doing final design1. At the beginning, I used the get method to transfer values to the back-end springboot. It was very friendly when debugging the h5 page. There was no error and everything went smoothly. The error message displayed by the name in the background is probably like this. I forgot to cut the picture (my name was entered in Chinese: fruit):
/search/itemname?name="Because the get request occurs in the url request header, so I searched everywhere for solutions to garbled characters, but all I found were decoding in the background. This did not meet my requirements, because the request header was garbled, and it was simply Didn't enter the program, so it's useless. After all the trouble, I finally felt that it would be better to use9x8x9c8b5cv
"&page=1&num=12, invalid characters found in the request header
It prints out like this:
Send a request in json format to the backend 4. For the backend, change the receiving format to @ RequestBody–that is, the json receiving format (Es7msg is an object I defined and used to receive values) Then you can successfully get the desired value I would like to remind everyone that it is best to use post to pass values, which can avoid a lot of garbled characters.
The above is the detailed content of How to solve the problem of garbled characters after uniapp submission. For more information, please follow other related articles on the PHP Chinese website!