From: Jarkko Hietaniemi Date: Sun, 2 Dec 2001 00:25:35 +0000 (+0000) Subject: encode()/decode() examples. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=681a7c689c2fc832adac45eb5c99f0321de883c2;p=p5sagit%2Fp5-mst-13.2.git encode()/decode() examples. p4raw-id: //depot/perl@13421 --- diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index ddde0f2..76257d4 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -700,6 +700,11 @@ Miscellaneous: Encodes string from Perl's internal form into I and returns a sequence of octets. For CHECK see L. +For example to convert (internally UTF-8 encoded) Unicode data +to octets: + + $octets = encode("utf8", $unicode); + =item * $string = decode(ENCODING, $bytes[, CHECK]) @@ -708,6 +713,10 @@ Decode sequence of octets assumed to be in I into Perl's internal form and returns the resulting string. For CHECK see L. +For example to convert ISO 8859-1 data to UTF-8: + + $utf8 = decode("latin1", $latin1); + =item * from_to($string, FROM_ENCODING, TO_ENCODING[, CHECK])