Encode::Unicode#
Το μισό XS του Encode::Unicode: οι codecs UTF-16, UTF-32 και UCS-2.
Encode/Unicode.pm is upstream’s. It creates one blessed hash per encoding - Name, size, endian, ucs2 - and registers it with Encode::define_encoding. The two methods below read those attributes and convert, exactly as Unicode.xs does: BOM detection and big-endian fallback for the BOM-less UTF-16/UTF-32, surrogate pairs, the U+FFFD substitution, and the CHECK handling (croak, warn, leave or consume the source).
use Encode;
printf "%vX\n", encode('UTF-16LE', "hi"); # 68.0.69.0
print decode('UTF-16', "\xFE\xFF\0A\0B"), "\n"; # AB (the BOM says big-endian)
printf "%vX\n", encode('UTF-16', "\x{1F600}"); # FE.FF.D8.3D.DE.0: BOM, surrogate pair
Οι κωδικοποιήσεις είναι οι UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UCS-2BE και UCS-2LE· το Encode φορτώνει αυτό το άρθρωμα την πρώτη φορά που κατονομάζεται μία από αυτές. Πρόκειται για εγγενή υλοποίηση του μισού XS του Encode::Unicode 2.20.
Διαφορές από το upstream#
Καμία.
Αρθρώματα#
Encode::Unicode::UTF7- Κωδικοποίηση UTF-7
Συναρτήσεις#
Άλλες συναρτήσεις#
decode#
$obj->decode($octets [, $check]) - οκτάδες UTF-16/32 ή UCS-2 σε συμβολοσειρά χαρακτήρων.
encode#
$obj->encode($string [, $check]) - συμβολοσειρά χαρακτήρων σε οκτάδες UTF-16/32 ή UCS-2.