Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > perl.unicode > #199

Re: UTF-8 encoding & decoding

Newsgroups perl.unicode
Date 2016-05-15 05:05 +0200
Subject Re: UTF-8 encoding & decoding
Message-ID <20160515030528.GA57966@plasmasturm.org> (permalink)
References <20160505143719.GA6420@pali> <572CB711.2060307@khwilliamson.com> <20160512142734.GK29844@pali>
From pagaltzis@gmx.de (Aristotle Pagaltzis)

Show all headers | View raw


* Pali Rohár <pali.rohar@gmail.com> [2016-05-12 20:23]:
> If both functions should do same thing, why we have duplicity?

Encode.pm is big and fairly slow, because it handles a zillion encodings
and has lots of options for handling invalid input data. Perl needs only
UTF-8 transcoding and needs it fast, so it has code for just that. Since
that code is there anyway, it can just as well be exposed to Perl space.

> And which one is preferred to use?

Well, either you need Encode.pm or you don’t. The built-ins are faster
and always loaded, but they only do UTF-8 and if you have invalid data
then all you get is a false return value and no other help. If you need
anything else you pay the memory and take the speed hit of Encode.pm.
(If you are working on a large application, chances are high that you
have Encode.pm loaded anyway.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Back to perl.unicode | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: UTF-8 encoding & decoding public@khwilliamson.com (Karl Williamson) - 2016-05-06 09:24 -0600
  Re: UTF-8 encoding & decoding pagaltzis@gmx.de (Aristotle Pagaltzis) - 2016-05-15 05:05 +0200

csiph-web