binmode(STDIN, ":shiftjis"); binmode(STDOUT, ":YOUR_DESIRED_OUTPUT_ENCODING");