Re: Always setting UTF-8 flag - am I bad?

[email protected] (Jean-Michel Hiver)
Newsgroups perl.unicode
Message-ID <[email protected]>
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.
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.