Erland Sommarskog wrote:

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.

Personally I try to use Encode as much as possible which does The Right Thing for me.

$string = Encode::decode ('utf-16', $octets); is pretty safe.

Regarding to speed, Encode seems pretty fast to me - but YMMV I guess.



Reply via email to