For some reason Visual Studio does not show me special characters when I query for an XML field. Maybe I stored them wrong? These are smart quotes
Here's the query:
select CustomFields from TABLE where ID=422567 FOR XML PATH('')
When I copy/paste into notepad++ I see this:
What are STS and CCH?
Strings are - as you surely know - just chains of numbers. What they mean and how they are interpreted is depending on codepages, encodings, little or big endian ...
Just have a look on this
This will produce this
As you see, there are characters which must be encoded, as there is no character expression for them, others are displayed with their corresponding "picture".
With codes above DEC 127 you enter dangerous terrain. The same string can produce quite different output depending on where you read it.
The "STS" and "CCH" Notepad shows to you, are taken from C1 Controls and Latin-1 Supplement.
This, and the written Smart qoutes in your example point to this. In order to allow smart qoutes there are general characters for start and end which are "replaced" with the fitting opening and closing qoutation marks.
Finally XML in SQL Server is always UTF16. Have a look at this feff0093 and feff0094. These are the signs UTF16 binds to
0x93
and0x94
. My small example shows this clearly...So the question is: Why does your picture not show the
“
and the”
?I don't know... The
select
you put in the first line would not "produce" this XML, it rather takes existing XML out of a column "CustomFields". I'm fairly sure, that this is not a "real" XML-column...