#! /usr/local/bin/perl # non-7bit-code を16進数にして出力 while(<>) { s/[\x80-\xff]/sprintf("[%02x]", unpack("C",$&))/eg; print; }