From 681a7c689c2fc832adac45eb5c99f0321de883c2 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Sun, 2 Dec 2001 00:25:35 +0000 Subject: [PATCH] encode()/decode() examples. p4raw-id: //depot/perl@13421 --- ext/Encode/Encode.pm | 9 +++++++++ 1 file changed, 9 insertions(+) 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]) -- 2.7.4