在android中为ksoap2设置编码utf-8
我对 ksoap2 有问题,我想在 android 中为 ksoap2 设置编码 utf-8,或者在标头中设置内容类型为 text/xml,charset=utf=8, 我的代码: //设置编码
envelope.encodingStyle = "utf-8";
//设置标题
envelope.headerOut = new Element[1];
envelope.headerOut[0] = buildAuthHeader();
private Element buildAuthHeader() {
String namesc = "http://xml.apache.org/xml-soap";
Log.i("---build--","--buildAuthHeader--->");
Element h = new Element().createElement(namesc, "Headers");
Element username = new Element().createElement(namesc, "Content-Type");
username.addChild(Node.TEXT, "text/xml;charset=UTF-8");
h.addChild(Node.ELEMENT, username);
return h;
}
但不起作用。请帮我。 谢谢。
I have problem with ksoap2, i want set encoding utf-8 for ksoap2 in android, or set content-type in header is text/xml,charset=utf=8,
my code:
//set encoding
envelope.encodingStyle = "utf-8";
//set header
envelope.headerOut = new Element[1];
envelope.headerOut[0] = buildAuthHeader();
private Element buildAuthHeader() {
String namesc = "http://xml.apache.org/xml-soap";
Log.i("---build--","--buildAuthHeader--->");
Element h = new Element().createElement(namesc, "Headers");
Element username = new Element().createElement(namesc, "Content-Type");
username.addChild(Node.TEXT, "text/xml;charset=UTF-8");
h.addChild(Node.ELEMENT, username);
return h;
}
but not work. please help me.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信它是这样完成的:
I believe that it is done like so: