XML-RPC 中文传递

阅读更多

XML-RPC 中文传递

 

/**
  * 支持中文,Base64编码传送 ,和java里的byte[] 对应
  */
 public Hashtable distributeDataBySingle(Vector v)
 {
  Hashtable result = new Hashtable();
  if(v != null && v.size() == 3)
  {
   byte[] rawUrlByte = (byte[])v.get(1);
   String rawUrl = coverUtf_8Str(rawUrlByte,"UTF-8");
   String feedIdStr = (String)v.get(0);
   long feedId = 0;
   try{
    feedId = Long.parseLong(feedIdStr);
   }catch(Exception e){
    feedId = 0;
   }
   String whichBspStr = (String)v.get(2);
   
   int whichBsp = 0;
   try{
    whichBsp = Integer.parseInt(whichBspStr);
   }catch(Exception e){
    whichBsp = 0;
   }
   
   initProperties(configPath);
   
   initDB(whichBsp);
   result = addBySingle(rawUrl,feedId);
  }
  else
  {
   result.put("resCode","-1");
    result.put("resInfo","param is wrong!");
    return result;
  }
  return result;
 }
 

你可能感兴趣的:(XML)