问题
I am having a very strange issue in my android app. I receive xml file from server and perform operation based on xml content.
It is working on almost every network for eg. AT&T, Verizon in USA, airtel, vodaphone and others in india.But it not working on sprint network USA.
When i tried to find xml content i am getting some byte code or unicode not the plain xml file. I looked for more information i found other also has faced this issue on sprint evdeo. people says turn off byte mobile optimization here
I am not able to turn off mobile byte optimization. If i switch to wifi network it receive file properly. Issue occur on sprint cellular network only.
Any help or any pointer will be very much appreciated. Thanks in advance
回答1:
Thanks everybody for responding my queries i have resolved it few days back.
Actually sprint compress any xml file using gzip encoding. I tried to unzip the Http response using following it worked like charm. Most of the network provide compress audio/video data but sprint is doing for all data sent across the network.
I use following code which resolved my issue.
HttpEntity httpEntity = reponseData.getEntity();
InputStream res = AndroidHttpClient.getUngzippedContent(httpEntity);
linputSourceFromServerResponse = new InputSource(res);
Document doc = builder.parse(linputSourceFromServerResponse);
回答2:
Check if the ouput is just a gzipped xml.
Use GZIPInputStream
to read the plain xml.
回答3:
With a first sight, looks like an encoding issue.. If it is possible, you could send an email to sprint network and explain your problem, maybe they ll give you an answer or a logical explanation.
来源:https://stackoverflow.com/questions/19020512/receive-xml-file-is-corrupted-on-sprint-network