Allow special character in WELL_FORMED_XML Message

  • sql server developer

    SSCarpal Tunnel

    Points: 4746

    Hi All,

    I've created a Message Type with VALIDATION = WELL_FORMED_XML.

    When I have special characters like ãpple in the XML string it is not sending the message. If I don't have special characters then it is working. How can i make it to work ever with special characters like ã, ñ etc?

    Any help would be highly appreciated.

    Thanks!

  • Nils Gustav Stråbø

    SSChampion

    Points: 11259

    A shot in the dark: Try using ã instead of ã

    Ref http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

  • sql server developer

    SSCarpal Tunnel

    Points: 4746

    I'm not using just ã. I want to be able to use all special characters like these...When i run a query like CAST('ãpple' AS XML) works but why is Service Broker message type not treating that as well formed XML?

  • Mark Cowne

    One Orange Chip

    Points: 26698

    Does your XML have an encoding attribute such as

    <?xml version="1.0" encoding="UTF-16"?>

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • sql server developer

    SSCarpal Tunnel

    Points: 4746

    Below is the XML string that i'm trying to send....I'm getting error because we have special character ã in <NewValue>ãpple</NewValue> tag. If I replace that with apple, it is working. My question is how can i send message even if we have such special characters

    <Message>

    <MsgHeader>

    <MessageType>UPDATE </MessageType>

    <HeaderBody>

    <DatabaseName>DataBaseName</DatabaseName>

    <PrimaryKey>XXXX </PrimaryKey>

    <TableName>TableName</TableName>

    </HeaderBody>

    </MsgHeader>

    <MessageBody>

    <FieldCount>1 </FieldCount>

    <FieldInfo>

    <FieldName>Name</FieldName>

    <OldValue>John</OldValue>

    <NewValue>ãpple</NewValue>

    </FieldInfo>

    </MessageBody>

    </Message>

  • R.P.Rozema

    SSChampion

    Points: 12300

    To be able to store all characters you should use nvarchar() or nchar() (as opposed to varchar() or char()) everywhere where the values are stored. i.e. in all your tables, variables and constants.

    A text constant is made into a n-type by prefixing it with a capital N. For example:

    declare @txt nvarchar(100);

    select @txt = N'test';



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

  • sql server developer

    SSCarpal Tunnel

    Points: 4746

    Thanks so much! It worked after changing the datatype to NVARCHAR.

  • R.P.Rozema

    SSChampion

    Points: 12300

    Good to see that that helped you. But it was merely a guess for me.

    You're only getting vague answers and you only have yourself to blame for that: you've not given enough information. For example:

    - what's the code you're trying to execute?

    - what's the text & number of the error you're getting?

    The good people here can do a lot, but they're not mindreaders.

    Provide us some details and you'll likely get much more useful answers.



    Posting Data Etiquette - Jeff Moden[/url]
    Posting Performance Based Questions - Gail Shaw[/url]
    Hidden RBAR - Jeff Moden[/url]
    Cross Tabs and Pivots - Jeff Moden[/url]
    Catch-all queries - Gail Shaw[/url]


    If you don't have time to do it right, when will you have time to do it over?

Viewing 8 posts - 1 through 8 (of 8 total)

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