
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- Date: Mon, 13 Feb 2006 14:12:16 +0900 (JST)
- From: David E <dave@???>
- Subject: Re: [tlug] unicode and Perl- how to pass command line unicodearguments
- References: <43EFF8C4.4050704@example.com>
On Date: Mon, 13 Feb 2006 12:11:00 +0900, David Riggs <dariggs@example.com> wrote:
> David E replied to David Riggs:
>
> On Date: Sun, 12 Feb 2006 17:30:00 +0900, David Riggs
> <dariggs@example.com> wrote:
> > Does anyone know how to pass real unicode kanji to perl on the command
> > line? (Not just bytes that appear as kanji but are passed on as
> bytes.)---
>
> --Reply:
> ---You might need to do
> --- utf8::decode($whatever)
> ---on the args you read in.
>
> --More info here:
> ---http://search.cpan.org/~jhi/perl-5.8.0/pod/perluniintro.pod
> Thanks David. I got something similar to work (follow your link):
>
> use Encode 'decode_utf8';
> $Unicode = decode_utf8($bytes);
>
> Somehow your suggested utf8::decode($x) only returns a "1", presumably
> for success, and I do not see how to get it to return the value.
utf8::decode does its work in place on $x.
Here's the blurbo from perldoc utf8
* utf8::decode($string)
Attempts to convert in$B!>(Bplace the octet sequence in UTF$B!>(BX to the
corresponding character sequence. The UTF-8 flag is turned
on only if the source string contains multiple$B!>(Bbyte UTF$B!>(BX
characters. If $string is invalid as UTF$B!>(BX, returns
false; otherwise returns true.
TTMMTOHWTDI: There are too many more than one hundred ways to do it.
Or something like that.
Dave
>
> By the way, I find that perl m/// and s/// just do not work on kanji
> unicode typed directly into the expression. But if you set the kanji
> into a variable, and then immediately use it one of those operators, its
> fine.
>
> Very mystifying.
>
> Thanks for the help, now that I realize these two additional things I
> have perl unicoding away.
>
> And I thought perl was supposed to just work with unicode!
>
>
> David Riggs
>
> --
> The TLUG server is hosted by Open Source Development Lab Japan.
> http://www.osdl.jp/
>
> To unsubscribe from this mailing list,
> please see the instructions at http://www.tlug.jp/list.html
Home |
Main Index |
Thread Index