From: Jarkko Hietaniemi Date: Wed, 2 May 2001 02:43:09 +0000 (+0000) Subject: Add an encoding conversion example. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b106fbe4f3ffa9d3bdfbd0c591c8707c76721d5;p=p5sagit%2Fp5-mst-13.2.git Add an encoding conversion example. p4raw-id: //depot/perl@9947 --- diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm index fe235f1..3792324 100644 --- a/ext/Encode/Encode.pm +++ b/ext/Encode/Encode.pm @@ -524,10 +524,18 @@ L. from_to($string, FROM_ENCODING, TO_ENCODING[, CHECK]) -Convert the data between two encodings. How did the data in $string -originally get to be in FROM_ENCODING? Either using encode() or -through PerlIO: See L. For CHECK see -L. +Convert B the data between two encodings. How did the data +in $string originally get to be in FROM_ENCODING? Either using +encode() or through PerlIO: See L. For CHECK +see L. + +For example to convert ISO 8859-1 data to UTF-8: + + from_to($data, "iso-8859-1", "utf-8"); + +and to convert it back: + + from_to($data, "utf-8", "iso-8859-1"); =back @@ -756,7 +764,7 @@ want to bring into memory. For example to convert between ISO 8859-1 open(G, ">:utf8", "data.utf") or die $!; while () { print G } - # Could do "print G " but that would pull + # Could also do "print G " but that would pull # the whole file into memory just to write it out again. See L for more information.