要解决在url上传递汉字参数这个问题,首先要知道url编码方式在哪里控制的,如果不知道编码方式即使把汉字
传过去了也是乱码不会被识别,这样就会造成sql查询错误。
我的解决方案是,就以tomcat为例子吧,比如tomcat装在D:/apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.5.20 下,</chsdate>就打开D:/apache-tomcat-<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">5.5.20</chsdate>/conf/server.xml,在77行处,添加一个属性设置:URIEncoding="GBK",这样可以避免页面乱码。设置后如下图所示
<shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><img alt="" src="https://p-blog.youkuaiyun.com/images/p_blog_youkuaiyun.com/chenpy/hehe.JPG"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 414.75pt; HEIGHT: 73.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/CHENPE~1/LOCALS~1/Temp/msohtml1/01/clip_image001.png" o:title=""></imagedata></shape>