Retrieving Special character

  • Hi,

    I stored some data in Sql server, which contains special characters.  When I am retrieve the data in xml format, the special characters are converting into text.

    Ex: I have a Items table with the following information.

    Items Table

    ItemNo          ItemName

    1                                            CRAZY PERU & Alpa’ca Beanie”

    Select Query

    Select * from Items for xml raw

     

    Result of Query is

     

    <row id="51520" name="CRAZY PERU &amp; Alpa&apos;ca Beanie&quot;"/>

     

    Here the special characters & is displaying as &amp; singlequote() is displaying as &apos; double quotes() are displaying as &quot;

     

    But I want to displaying the result without converting in the following format:-

    <row id="51520" name="CRAZY PERU & Alpa’ca Beanie”"/>

     

    Please let us know how to display it.

     

    Thanks and regards,

    Thirumalaraj.

     

  • The ampersand, apostrophe, and quote, as well as less than and greater than ( < and > ) are reserved characters in standard XML format. Many tools that expect XML input will choke if they are not "escaped" as you noticed above.

    What are you using to display them? There are likely workarounds, but without more info it's hard to tell you what to do.

  • Hi,

    I am dispalying this data on the web page, which is ASP.NET Application. So, can you please tell me, how to display this data on the web page, without converting this characters in to the text.

    Thanks and regards,

    Thirumalaraj.

  • While I'm not an ASP developer, MS products all seem to handle xml files just fine, so you shouldn't have to do anything. The XML parser should convert &amp; right back into an ampersand, etc.

    I guess I don't understand why these special characters are a problem for you, as they are standard reserved characters. Can you explain which piece of the process doesn't like them, what that piece does, what it's written it, how it's reading the .xml files, etc?

     

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply