Re: unicode

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
ZIGLIO, Frediano, VF-IT wrote:
> 1> insert into #tmp1 values(N'þ')
> 2> go
> 1> select * from #tmp1
> 2> go
> c
> §
> ?
> þ
> (3 rows affected)

Wow.  I was able to reproduce that using U+0174.  (cf.
http://www.unicode.org/charts/PDF/U0100.pdf.)  I can't seem to type that
character in here; it's a W with a ^ on top.  Using Microsoft's tool, when
I insert that into an NVARCHAR without the 'N' prefix, I get a plain "W"! 


> As you can see it seems that not using N prefix string got converted
> twice, one ucs2->single and another single->ucs2 (nvarchar use ucs2).

Right.  Without the 'N' prefix, the server took perfectly good UCS-2,
converted it "down" to the database's single-byte encoding (Latin1-General
in my case), and then stored that character as UCS-2 in the NVARCHAR
column.  With the 'N', it did it right.  

In the case of my W-with-hat, there's apparently a conversion rule that
says to keep the main character and discard the "decoration" if possible. 


Thanks for helping me understand this better.  It's a little hard for me
to see it as a "feature"....

Regards, 

--jkl

(Interestingly, on my BSD system, I see your character as 'þ' (phi?) but
on my Win32 box it appears as one character that looks like 'io' squished
together with the 'i' having a little bar across the middle. Font or
encoding, I don't know.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.