Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm developing a RESTfull web services using WCF. In this service I'm returning a XML in Stream format which contains '£'. I get this in symbol in XML but on client side I get the '?' instead of '£'.
C#
public Stream HandleMessageStream()
{
    StreamReader reader = new StreamReader(request);
    string text = "<price>£ 10.00</price>";
    UTF8Encoding encoding = new UTF8Encoding();
    MemoryStream ms = new MemoryStream(encoding.GetBytes(text));
    WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";
    return ms;
}

I tried with different encoding but didn't find the answer.
Can anyone help me?
Posted
Updated 16-May-13 3:54am
v3
Comments
skydger 16-May-13 9:45am    
Have you considered to use XmlWriter instead of this?

1 solution

Try by using "U+00A3". Its a unicode for "£"(Pound sign). Refer below link for "List of Unicode characters".
http://en.wikipedia.org/wiki/List_of_Unicode_characters

I copied this idea of solution from below answer of Sergey Alexandrovich Kryukov.
What is this ASCII character code ?
 
Share this answer
 
Comments
Bhushan Chandane 16-May-13 23:49pm    
If i put "U+00A3" instead of "£" in string that is like "<price>'U+00A3' 10.00</price>" then it considers "U+00A3" as part of the string and does not parse it to "£".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900