Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] unicode and Perl- how to pass command lineunicode arguments



Hi David,

Did you ever get your unicode in m// or s/// problem worked out? I
didn't see a solution anywhere in the thread. 

Constructs like:

s/日本語/英語/
m/日本語/

seem to work fine for me in the middle of the program. I'm using "use
utf8;" as per normal, so I'm in a bit of wonderment as to why it doesn't
work for you. If you want me to have a boo at your code to see if we can
fix it, send me an off-list mail.

Neil


On Mon, 2006-02-13 at 12:11 +0900, David Riggs 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
> 
> Dave
> -----------
> 
> 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.
> 
> 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
> 

Attachment: signature.asc
Description: This is a digitally signed message part


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links