June 9, 2015 at 11:47 am
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!
June 9, 2015 at 2:14 pm
A shot in the dark: Try using ã instead of ã
Ref http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
June 9, 2015 at 2:19 pm
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?
June 9, 2015 at 2:23 pm
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/61537June 9, 2015 at 2:28 pm
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>
June 12, 2015 at 7:50 am
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';
June 12, 2015 at 11:49 am
Thanks so much! It worked after changing the datatype to NVARCHAR.
June 15, 2015 at 2:59 am
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.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply