develooper Front page | perl.unicode | Postings from May 2016

UTF-8 encoding & decoding

Thread Next
From:
Pali =?utf-8?B?Um9ow6Fy?=
Date:
May 6, 2016 10:35
Subject:
UTF-8 encoding & decoding
Message ID:
20160505143719.GA6420@pali
Hi!

I though that I understand UTF-8 encoding/decoding done in perl until I
looked into source code of Encode package... (exactly sub encode_utf8)

Before... I only read description of Encode package (not source code):
https://metacpan.org/pod/Encode#UTF-8-vs.-utf8-vs.-UTF8

I tried to find some more information (ideally those which answer my
question) but without success. Can you help me? My questions are:

1. What is difference between those two calls?

 utf8::encode($str);

and

 $str = Encode::encode('utf8', $str);

2. What is difference between those?

 utf8::decode($str);
 $str = Encode::decode_utf8($str);

3. Where is implementation of utf8::encode/decode functions? It is not
in utf8.pm, nor in utf8_heavy.pl and also not in unicore/Heavy.pl. And
what those functions doing?

-- 
Pali Rohár
pali.rohar@gmail.com

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About