1#!/usr/bin/perl
2#
3# [w3m-dev 03783]
4# Install it in $LIB/utf8.cgi and configure keymap as
5#   keymap  "x u"   GOTO file:/$LIB/utf8.cgi
6#
7$conv = "lv -Iu -Oe";
8# $conv = "iconv -f UTF-8 -t EUC-JP";
9$type = $ENV{W3M_TYPE} || "text/plain";
10$url = $ENV{W3M_URL};
11$file = $ENV{W3M_SOURCEFILE};
12-f $file || exit;
13$| = 1;
14print <<EOF;
15Content-Type: $type; charset=EUC-JP
16
17EOF
18if ($type =~ /^text\/html/i && $url) {
19	print "<BASE HREF=\"$url\">\n";
20}
21exec split(" ", $conv), $file;
22