当前位置: 代码迷 >> Web前端 >> IE6中文奇数乱偶数不乱有关问题解决
  详细解决方案

IE6中文奇数乱偶数不乱有关问题解决

热度:115   发布时间:2012-09-07 10:38:15.0
IE6中文奇数乱偶数不乱问题解决
问题描叙:通过get方式传递中文参数IE6出现中文奇数乱偶数不乱;

在互联网搜索了一下 有很多人都遇到过这种问题,
这确实是IE6的一个bug.

经管我们采用数据库编码、代码编码、页面编码、服务器编码通通都一至,但是依然会出现这个问题,

我们只需要在url上面进行压码  <%=URLEncoder.encode( 中文参数 )%>
在后台无需解码,服务器会帮我们自动解码

特殊情况的可以通过 js压码, 更特殊的可以通过后台压码(我这里就是这情况解决的);
tomcat 内部转换代码:
  protected boolean postParseRequest(org.apache.coyote.Request req,
                                       Request request,
                                       org.apache.coyote.Response res,
                                       Response response)
            throws Exception {

        // XXX the processor may have set a correct scheme and port prior to this point,
        // in ajp13 protocols dont make sense to get the port from the connector...
        // otherwise, use connector configuration
        if (! req.scheme().isNull()) {
            // use processor specified scheme to determine secure state
            request.setSecure(req.scheme().equals("https"));
        } else {
            // use connector scheme and secure configuration, (defaults to
            // "http" and false respectively)
            req.scheme().setString(connector.getScheme());
            request.setSecure(connector.getSecure());
        }

        // FIXME: the code below doesnt belongs to here,
        // this is only have sense
        // in Http11, not in ajp13..
        // At this point the Host header has been processed.
        // Override if the proxyPort/proxyHost are set
        String proxyName = connector.getProxyName();
        int proxyPort = connector.getProxyPort();
        if (proxyPort != 0) {
            req.setServerPort(proxyPort);
        }
        if (proxyName != null) {
            req.serverName().setString(proxyName);
        }

        // Copy the raw URI to the decodedURI
        MessageBytes decodedURI = req.decodedURI();
        decodedURI.duplicate(req.requestURI());
       
        // Parse the path parameters. This will:
        //   - strip out the path parameters
        //   - convert the decodedURI to bytes
        parsePathParameters(req, request);
       
        // URI decoding
        // %xx decoding of the URL
        try {
            req.getURLDecoder().convert(decodedURI, false);
        } catch (IOException ioe) {
            res.setStatus(400);
            res.setMessage("Invalid URI: " + ioe.getMessage());
            connector.getService().getContainer().logAccess(
                    request, response, 0, true);
            return false;
        }
今天看tomcat源码的时候发现的,修改下,
  相关解决方案