我采用http协议post方式上报XML文件到一个url,到了服务器端解析的时候,发现发送的
<?xml version="1.0" encoding="GBK"?>变成了<?xml version=%221%2EO%22+encoding%3D%22GBK%22%3F%3E&
请问是怎么回事啊?
代码如下
XMLDoc := TXMLDocument.create(Nil);
  XMLDoc.Active := true;
  XMLDoc.Version := '1.0';
  XMLDoc.Encoding := 'GBK';
  url := 'http://192.168.0.8:8080/proxy/plproxy?swglm=320200004031696';
  IdHTTP := TIdHTTP.create(Nil);
  IdHTTP.Request.AcceptEncoding := 'gbk';
  IdHTTp.Request.AcceptCharSet := 'GBK';
  IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';
  IdHTTP.Request.ContentLength := Length(Memo1.Text);
  strsends := tstringlist.create;
  strsends.AddStrings(XMLDoc.xml);
  strResult := IdHTTP.Post(url, strsends);

解决方案 »

  1.   

    但问题是我通过其他方式发送GBK,没有问题啊
      

  2.   

    还是我这边的mysql的编码没有选择正确
      

  3.   

    服务端报错:“error on line 1:the value flllowing "version" in the xml declaration must be a quoted string. ”
      

  4.   

     "version"后面跟的必须是一个被引用的字符串。
      

  5.   

      IdHTTP.Request.AcceptEncoding := 'gbk';
      IdHTTp.Request.AcceptCharSet := 'GBK';
    是不是这两句的问题,不用写吧