develooper Front page | perl.perl5.porters | Postings from February 2004

Re: Question regarding Unicode handling in perl: auto-sensing

From:
Nick Ing-Simmons
Date:
February 23, 2004 13:36
Subject:
Re: Question regarding Unicode handling in perl: auto-sensing
Message ID:
20040223213545.16547.3@llama.ing-simmons.net
Andreas Jaekel <jaekel@cablecats.de> writes:
>> >The "perluniintro" man page gives example code on how to do that:
>> >
>> >	use Encode 'encode_utf8';
>> >	if(encode_utf8($buf)) { ...
>> 
>> That is the wrong way round. You have raw octets you want to see 
>> if they are characters.
>> So you want to _decode_ them and see if it works.
>
>Decode does work!  My problem is solved!  Thank you very much!
>
>I took the sample code from the man page I mentioned (perluniintro), I
>just checked again.  The sample code uses encode_utf8:
>
>	[...]
>               if (encode_utf8($string_of_bytes_that_I_think_is_utf8)) {
> 	[...]
>
>The whole "encode" and "decode" is pretty confusing to me as it is,
>(encode to what?  decode from where? "encode to perl-internal?")
>but please consider making my life easier by fixing the man page :)

Yes we should





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