perl-unicode

Always setting UTF-8 flag - am I bad?

2004-07-29 09:30:58
I working with an XS module that passes queries to MS SQL Server and
returns data back using SQLOLEDB. MS SQL Server stores Unicode data
as UTF-16. Also, all metadata is UTF-16.

Currently when I get Unicode data back from SQL Server, I convert it to
UTF-8, stash it in an SV, and then set the UTF-8 flag, without checking
whether this is really necessary.

Is this a OK thing to do? Or should I first try to convert to the ANSI
code page, and if that fails convert to UTF-8? It seems to me that this
would come with a performance cost, so I rather not.

An even more interesting thing is that column and parameter names can
serve as hash keys under some circumstances. What implcations this has,
I have not even tested yet...

-- 
Erland Sommarskog, Stockholm, esquel(_at_)sommarskog(_dot_)se

<Prev in Thread] Current Thread [Next in Thread>