in reply to Re: Search & replace of UTF-8 characters ?
in thread Search & replace of UTF-8 characters ?

I'm asking, not arguing...

Wouldn't it have worked if the script was called via a command-line pipe? So if it was called as

./levians_program.pl < source.bib > source_corrected.bib
that ought to work, right?

Replies are listed 'Best First'.
Re^3: Search & replace of UTF-8 characters ?
by ikegami (Patriarch) on Feb 25, 2010 at 17:24 UTC

    If you added some means of decoding to STDIN and encoding STDOUT, yes.

    >perl -CSD -we"print chr 0x2660" | perl -CSD -we"printf qq{%X\n}, ord +<STDIN>" 2660

    -C even works if you read STDIN through ARGV:

    >perl -CSD -we"print chr 0x2660" | perl -CSD -we"printf qq{%X\n}, ord +<>" 2660

    I don't have time to check the other tools right now.

    Update: Hey! -C DOES work with ARGV. I knew binmode and use open had problems with ARGV, so I took the OP's word for it when he said -C didn't work with it either.

    >perl -CSD -we"print chr 0x2660" > foo >perl -CSD -we"printf qq{%X\n}, ord <>" foo 2660