• xml传输过程中中文乱码


    ------------------------------------------request:-----------------------------------------------

    public String requestSendDingHuoMemInfo(String iFPassWord,String education,String educationCode,MemberBaseInfo memberBaseInfo){

    String requestRegistXml="<?xml version="1.0" encoding="UTF-8"?>";
    requestRegistXml+="<ARAMARK_REQUEST>";
    requestRegistXml+="<HEAD>";
    requestRegistXml+="<VERSION>1.0</VERSION>";
    requestRegistXml+="<PASSWORD>"+iFPassWord+"</PASSWORD>";
    requestRegistXml+="<REQUEST_CUS>"+education+"</REQUEST_CUS>";
    requestRegistXml+="<REQUEST_TYPE>ZC001</REQUEST_TYPE>";
    requestRegistXml+="<PROJECT_CODE>"+educationCode+"</PROJECT_CODE>";
    requestRegistXml+="<REQUEST_UNIQUE>"+UUID.randomUUID().toString().replace("-", "")+"</REQUEST_UNIQUE>";
    requestRegistXml+="</HEAD>";
    requestRegistXml+="<BODY>";
    if(memberBaseInfo != null){
    requestRegistXml+="<CUSTOMER_PASSWORD>"+memberBaseInfo.getPasswd()+"</CUSTOMER_PASSWORD>";
    requestRegistXml+="<SCHOOL_NO>"+memberBaseInfo.getSchool().getCode()+"</SCHOOL_NO>";
    requestRegistXml+="<CUSTOMER_NO>"+memberBaseInfo.getIdNumber()+"</CUSTOMER_NO>";
    requestRegistXml+="<CUSTOMER_NAME>"+memberBaseInfo.getName()+"</CUSTOMER_NAME>";
    requestRegistXml+="<USER_AGE>"+memberBaseInfo.getUserAge()+"</USER_AGE>";
    requestRegistXml+="<CUSTOMER_MALE>";
    requestRegistXml+=memberBaseInfo.isMale()?"1":"0";//性别
    requestRegistXml+="</CUSTOMER_MALE>";
    requestRegistXml+="<CUSTOMER_EMAIL>"+memberBaseInfo.getEmail()+"</CUSTOMER_EMAIL>";
    requestRegistXml+="<CUSTOMER_MOBILE>"+memberBaseInfo.getMobile()+"</CUSTOMER_MOBILE>";
    requestRegistXml+="<STATUS>"+memberBaseInfo.getStatusStr()+"</STATUS>";
    requestRegistXml+="<WEIGHT>"+memberBaseInfo.getWeight()+"</WEIGHT>";
    requestRegistXml+="<HEIGHT>"+memberBaseInfo.getHeight()+"</HEIGHT>";
    requestRegistXml+="<OPEN_ID>"+memberBaseInfo.getOpenid()+"</OPEN_ID>";
    requestRegistXml+="<ACTIVE>"+memberBaseInfo.getActive()+"</ACTIVE>";
    }
    requestRegistXml+="</BODY>";
    requestRegistXml+="</ARAMARK_REQUEST>";
    return requestRegistXml;
    }

    -------------------------------getRequest----------------------------------------

    request.setCharacterEncoding("utf-8");
    String requestXml1 = requestString(request);

    String requestXml = new String (requestXml1.getBytes("ISO-8859-1"),"gbk"); 

  • 相关阅读:
    关于J2SE/Jsp/Sping/Hibernate/Struts2的视频下载
    JQuery插件之图片轮播插件–slideBox
    javascript学习-创建json对象数据,遍历
    MD5算法原理
    【Linux】linux经常使用基本命令
    藏书阁(非技术流书籍)
    搭建自己的SIPserver:开源sipserveropensips的搭建及终端TwInkle的使用
    linux下仅仅有rman备份集的异机不同文件夹恢复
    URAL 1684. Jack&#39;s Last Word KMP
    javabean总结
  • 原文地址:https://www.cnblogs.com/kongxc/p/7282087.html
Copyright © 2020-2023  润新知