From owner-FreeBSD-tech-jp@jp.FreeBSD.org Mon Jul 21 02:26:25 2003
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id h6KHQPv92778;
	Mon, 21 Jul 2003 02:26:25 +0900 (JST)
	(envelope-from owner-FreeBSD-tech-jp@jp.FreeBSD.org)
Received: from ms1.din.or.jp (ms1.din.or.jp [210.135.65.21])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id h6KHQOT92773
	for <FreeBSD-tech-jp@jp.FreeBSD.org>; Mon, 21 Jul 2003 02:26:24 +0900 (JST)
	(envelope-from tshiozak@bsdclub.org)
Received: from localhost (ppa01-3324.din.or.jp [210.173.225.24])
	by ms1.din.or.jp (8.11.7+Sun/3.7W) with ESMTP id h6KHQNn27490
	for <FreeBSD-tech-jp@jp.FreeBSD.org>; Mon, 21 Jul 2003 02:26:23 +0900 (JST)
Message-Id: <20030721.022622.68557713.tshiozak@bsdclub.org>
To: FreeBSD-tech-jp@jp.FreeBSD.org
From: "T.SHIOZAKI" <tshiozak@bsdclub.org>
In-Reply-To: <20030720170642.E75343@ryu16.org>
References: <20030718.003258.68562311.tshiozak@bsdclub.org>
	<20030718232334.C75343@ryu16.org>
	<20030720170642.E75343@ryu16.org>
X-Prom-Mew: Prom-Mew 3.2am01 (procmail reader for Mew)
X-My-Web-Root: http://www.imou.to/~AoiMoe/
X-Organization: The I18n/M17n project On Unix environments (IMOU), Japan.
X-Mailer: Mew version 3.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Reply-To: FreeBSD-tech-jp@jp.FreeBSD.org
Precedence: list
Date: Mon, 21 Jul 2003 02:26:22 +0900
X-Sequence: FreeBSD-tech-jp 3380
Subject: [FreeBSD-tech-jp 3380] Re: LIBICONV(in kernel) 16bit extension, and ...
Sender: owner-FreeBSD-tech-jp@jp.FreeBSD.org
X-Originator: tshiozak@bsdclub.org
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+030702


$B1v:j$G$9!#(B


From: "R. Imura" <imura@ryu16.org>
Subject: [FreeBSD-tech-jp 3378] Re: LIBICONV(in kernel) 16bit extension, and ...
Date: Sun, 20 Jul 2003 17:06:42 +0900
Message-ID: <20030720170642.E75343@ryu16.org>

> On Fri, Jul 18, 2003 at 11:23:34PM +0900, R. Imura wrote:
> > $B$,!"4pK\E*$K(B iconv(3) $B$,CN$i$J$$%-%c%i%/%?%;%C%H$OCN$i$J$$$N$G!"(B
> > $B%-%c%i%/%?%;%C%H$KIU2C$9$kJ8;zNs$+$i!"Nc$($P4Z9q8lMQ$G$b$J$/(B
> > $BCf9q8lMQ$G$b$J$/!"F|K\8lMQ$N%W%i%9%"%k%U%!JQ49%m%8%C%/E,MQ$,(B
> > $BI,MW$G$"$k$3$H$r<1JL$9$k$?$a$N<1JL;R$r9)IW$9$kI,MW$,$"$j$^$9$M!#(B
> 
> $B$3$N@~$G!"(Buserland $BB&$K(B quirk $B%3!<%I$r;}$C$F$-$F$_$^$7$?!#(B
> ($BHyL/$K1x$$!D(B)
> 
> http://www.ryu16.org/FreeBSD/kiconv/kiconv-4_8-20030717-20030720.diff

$B8D?ME*$J46A[$H$7$F$O!"$b$C$HC1=c$K$J$k$h$&$J5$$,$9$k$s$G$9$h$M!#(B

$B;d$,%$%a!<%8$7$F$$$?$N$O<!$N$h$&$J46$8$G$9!'(B

$BI,MW$J$N$O!"(B
  - quirk $B$,I,MW$J(B charset $BL>$NH=JL(B
  - $B$=$N(B charset $B$H!"(Bquirk $BA0$N(B charset $B$H$NBP1~I=(B
  - $B<B:]$N(B quirk table
$B$J$N$G!"(Bkiconv $B$NCf$K(B

struct quirk_replace_list {
	uint16_t from, to;
};

static struct quirk_replace_list quirk_eucjp_cp932[] = {
	{ 0x00a2, 0xffe0 },
	{ 0x00a3, 0xffe1 },
	{ 0x00ac, 0xffe2 },
	{ 0x2016, 0x2225 },
	{ 0x203e, 0x007e },
	{ 0x2212, 0xff0d },
	{ 0x301c, 0xff5e }
};

#define NumOf(n)	(sizeof((n)) / sizeof((n)[0]))
static struct {
	const char *quirk_codeset, *base_codeset;
	struct quirk_replace_list (*replace_list)[];
	size_t num_of_replaces;
} quirk_list[] = {
	{ "eucJP,CP932", /* XXX: we should use "eucJP-ms" */
	  "eucJP",  
	  &quirk_eucjp_cp932,
	  NumOf(quirk_eucjp_cp932) }
};

/*
 * search_quirk:
 *	search the quirk entry.
 *
 * usage:
 *	iconv_t cd;
 *	struct quirk_replace_list *replace_list;
 *	size_t num_of_replaces;
 *
 *	cd = iconv_open(search_quirk(cs, &replace_list, &num_of_replaces),
 *			"XXX");
 */
static const char *
search_quirk(const char *given_codeset,
	     struct quirk_replace_list **replace_list,
	     size_t *num_of_replaces)
{
	size_t i;

	*replace_list = NULL;
	*num_of_replaces = 0;
	for (i=0; i<NumOf(quirk_list); i++)
		if (strcmp(quirk_list[i].quirk_codeset, given_codeset) == 0) {
			*replace_list = *quirk_list[i].replace_list;
			*num_of_replaces = quirk_list[i].num_of_replaces;
			return quirk_list[i].base_codeset;
		}

	return given_codeset;
}


$B$H$$$&$h$&$J46$8$N$7$/$_$r:n$C$F$*$$$F!"(B

1. iconv_open $B$r8F$VA0$K(B quirk_list $B$rC5:w$7$F!"(B
   $B$b$H$b$HM?$($i$l$?(B codeset $B$H(B quirk_charset $B$,0lCW$9$k$b$N$rC5$7!"(B
   $B$"$l$P(B base_charset $B$r!"$J$1$l$P$b$H$b$H$N(B codeset $B$r(B iconv_open $B$XEO$9(B
2. $BJQ49I=$r:n$k(B
3. 1 $B$G%(%s%H%j$,8+$D$+$C$F$$$?$i!"(Breplace_list $B$rJQ49I=$KE,MQ$9$k(B

$B$H$$$&46$8$G$9$+!#(B


> $BA02s$N(B
> > http://www.ryu16.org/FreeBSD/kiconv/kiconv-4_8-20030717.diff
> $B$KBP$9$k%Q%C%A$H$$$&7A$K$5$;$F$b$i$C$F$$$^$9!#(B
> 
> mount_ntfs -C eucJP
> $B$G!"(Biconv(3) $B$N$_$K$h$kJQ49%F!<%V%k;HMQ(B
> 
> mount_ntfs -C eucJP,CP932
> $B$H%+%s%^6h@Z$j$G3HD%J8;z%;%C%H$r;XDj$9$k$3$H$G!"(B
> Windows $B$HAj@-$N$h$$JQ49%F!<%V%k;HMQ$H$J$j$^$9!#(B
> 
> $B8D?ME*$K$O!"%f!<%6B&$,!"$I$&$$$&JQ49%F!<%V%k$r;HMQ$7$J$$$H(B
> $B$$$1$J$$$+!"$H$$$&$3$H$rKh2s0U<1$7$J$/$F$O$$$1$J$/$J$C$F(B
> $B$7$^$&$H$3$m$,!"B?>/IT?F@Z$+$J$!!"$H;W$$$^$9!#(B

$B8D?ME*$K$O$=$l$G$b9=$o$J$$$H;W$&$N$G$9$,!"$h$jMxJX@-$r8~>e$5$;$k$N$J$i$P!"(B
NTFS $B$G$O!"$[$H$s$I$N>l9g(B eucJP-ms $B$NJ}$NJQ49%k!<%k$G$"$k$Y$-$J$N$G!"(B
mount_ntfs $B$G(B

static struct {
	const char *charset, *quirk_charset;
} ntfs_quirk_list[] = {
	{ "eucJP", "eucJP,CP932" },
};

$B$H$$$&(B quirk $BI=$r$b$C$F$*$$$F!"$3$l$r8!:w$7$?7k2L8+$D$+$C$?%3!<%I$r(B
kiconv $B$KEO$7$F$d$k$H$$$$$+$b$7$l$^$;$s!#(B
# $B%f!<%6$X$N8+$;J}$O!"$b$&$A$g$C$H9M$($?$[$&$,$$$$$+$b$7$l$^$;$s$,!#(B

$B>e$N(B kiconv $B$N(B quirk $B$H9g$o$;$k$HFsEY<j4V$J$s$G$9$1$I$b!"(B
$BO@M}E*$K$O$9$C$-$j$7$^$9$M!#(B

$BA0$K$b=q$-$^$7$?$,!"K\Ev$O(B iconv $B$N$[$&$G(B(eucJP,CP932 $B$KAjEv$9$k(B)
eucJP-ms $B$H$$$&(B codeset $B$r%5%]!<%H$9$k$Y$-$J$N$G!"$=$l$O(B iconv $B$X$N(B
quirk $B$H$$$&7A$GO@M}E*$K(B kiconv $B$X$HDI$$=P$7$F!"0lJ}$G(B mount_ntfs $B$N(B
$B$[$&$G$=$l$H$OFHN)$7$?(B quirk $B$r;}$D$o$1$G$9$M!#(B

# $BM>CL$J$,$i!"(BNetBSD $B$N(B iconv $B$O:rF|(B eucJP-ms $B$r%5%]!<%H$7$^$7$?!#(B


$B$G$O!#(B

--
Takuya SHIOZAKI / $B1v:j(B $BBsLi(B

