Kenavy
Kenavy

Reputation: 1

Insert special character XML to SQL

I'm trying to update a column of type XML.

Text to be inserted in the XML fields: "& Decision ↨‼ Agreement"

Text converted to XML: <?xml version="1.0" encoding="utf-16"?><Informations xmlns="http://monschema"><Text lGic="fdf475bc-9fed-4f61-b321-f81949cb51ca" id="71e231e6-ecbd-4848-ba6f-004bdddefb79">&amp; Décision &#x12; &#x13; Accord</Text></Informations>

Error: Msg 9420, Level 16, State 1, Line 7 XML parsing: line 1, character 263 character non-compliant XML

I do not understand why the character with ascii code "&#x12" has a problem.

If I replace &#x12 by &#x20, it works !

Can you help me?

Thank you in advance

Upvotes: 0

Views: 2098

Answers (3)

Kenavy
Kenavy

Reputation: 1

I solved my problem.

This character is from a SQL obtenues view on ORACLE database. The character -> on ORACLE Is interpreted by ↨ on SQL SERVER.

I'll do a replace in my view

Upvotes: 0

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201528

The character references &#x12; and &#x13; denote control characters that are disallowed in XML 1.0. The real problem here is that they do not denote the characters you have in the text. The characters “↨‼” are U+21A8 UP DOWN ARROW WITH BASE and U+203C DOUBLE EXCLAMATION MARK, so they should be written as &#x21a8;&#x203c;.

The reason why get the odd character references is probably that in the CP437 encoding, “↨‼” are placed in code positions 12 and 13 (hex.). So this is an encoding confusion, and some conversion has applied a wrong conversion. In XML, the numbers in character references always mean Unicode code numbers.

Upvotes: 1

Tim Rogers
Tim Rogers

Reputation: 21713

These control characters are not supported in XML version 1.0 documents.

You should be able to change your version to 1.1 in the version attribute of the document, in which case the document should validate.

Upvotes: 0

Related Questions