开发者

webmethod encoding issue

开发者 https://www.devze.com 2022-12-20 23:45 出处:网络
I am facing a n00b issue in .NET webservices. the WebMethod return type is encoding an already encoded string (already encoded by my xml writer).

I am facing a n00b issue in .NET webservices. the WebMethod return type is encoding an already encoded string (already encoded by my xml writer).

Is there a way to turn of this off?

Example the prepared xml before the webmethod returns it <p> Hello World </p>

but the xml received by the client from the webmethod response &开发者_如何学编程lt;p&gt; Hello World &lt;/P&gt;

the ampersand is getting encoded by the web method

I am using xmlwriter object to build the xml... has anyone a solution to this?


I'm guessing you're sending this to a webpage. What you're getting is the encoding to show the actual '<' characters on the screen and not the HTML reserved characters.

These '<' '>' are reserved characters in a HTML page for the HTML parsers to use. If you want to use them in your page, you use &lt (lesser than) &gt (greater than).

Try putting a '\' in front of each of your HTML reserved character. This is a guess, I'm not sure that it'll work.

0

精彩评论

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