开发者

Send XML to WebService

I have an application in Flex how create and XML in UTF-8. When I open it everything is ok.

I send it to a server using a webservice (the xml is send like a string), the server receive the xml but all the accent, degree symbol and some other stuff are gone.

I create an XML and save it in a file

var xml:XML = myObject.xml;
file = new File(myObject.path);
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeUTFBytes("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml);
fileStream.close();

Later I reopened it and send it

var file:File = new File(myObject.path);
var fileStream:FileS开发者_如何学运维tream = new FileStream();
fileStream.open(file, FileMode.READ);
var xmlText:String = fileStream.readUTFBytes(fileStream.bytesAvailable);
var call:Object = service.AirSave("username", "password", xmlText);
call.addResponder(responder);

And a part of my XML

<Gen Name="App1">
  <Fam Name="Date">
    <Peo>
      <First>René</First>
      <Last>Jean</Last>
    </Peo>
    <Peo>
      <First>François</First>
      <Last>Jean</Last>
    </Peo>
  </Fam>
</Gen>

Someone know why and how to fix it?

Thank you


Ok I find the problem.

The server save the content of the file in a database but SQL Server don't support UTF-8. So bye bye accent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜