用IDEA調試代碼時,用postman測試請求url,發現post或者get請求中參數是中文的話,后台獲取的參數是亂碼,
一般兩個方面
發送請求的一方:postman的問題
接受請求的一方:tomcat的問題
postman的解決方案,可以先設置全局變量,將漢字寫到變量,並在參數中添加全局變量引用即可。
參考:https://www.cnblogs.com/carryLess/p/8006530.html
但並沒有什么luan用。。。。
之后就檢查tomcat的配置,發現tomcat默認配置並沒有對文字編碼進行配置
於是:
修改tomcat servlet.xml
<Connector port="8180" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
感謝https://blog.csdn.net/che_ku/article/details/79445808
