e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B
In message “Re: [ruby-dev:37737] Encoding.locale_charmap”
on Thu, 8 Jan 2009 17:45:45 +0900, Hidetoshi NAGAI
[email protected] writes:
|Ruby/Tk e$B$G!$e(Blocale e$B$Ne(B encoding [email protected]$k$?$a$Ke(B
|Encoding.find(Encoding.locale_charmap) e$B$J$s$F$3$H$r$7$F$$$?$N$G$9$,!$e(B
|Encoding.locale_charmap e$B$,6uJ8;zNs$rJV$9$3$H$,$"$k$h$&$G$9!%e(B
locale_charmape$B$N%=!<%9$O0J2<$NDL$j$G$9$+$i!"$3$l$,6uJ8;zNs$re(B
e$BJV$9$N$G$"$l$P!"e(Bnl_langinfo()e$B$,6uJ8;[email protected]$H;We(B
e$B$$$^$9!#[email protected]>o$J>uBV$G$O$J$$$G$7$g$&$,!"e(BRubye$B$+$i$Je(B
e$B$s$H$+$G$-$k$3$H$G$b$J$5$=$&$G$9!#e(B
VALUE
rb_locale_charmap(VALUE klass)
{
#if defined NO_LOCALE_CHARMAP
return rb_usascii_str_new2(“ASCII-8BIT”);
#elif defined HAVE_LANGINFO_H
char *codeset;
codeset = nl_langinfo(CODESET);
return rb_usascii_str_new2(codeset);
#elif defined _WIN32
return rb_sprintf(“CP%d”, GetConsoleCP());
#else
return Qnil;
#endif
}
|[email protected]>o$J>uBV$G$7$g$&$+!%e(B
|[email protected]>o$G$"$k$J$i!$$I$N$h$&$J>l9g$K$=$&$J$k$N$G$7$g$&$+!%e(B
e$B$`$7$m$3$C$A$,J9$-$?$$$G$9!#$I$s$J4D6-2<$G6uJ8;zNs$,[email protected]$i$l$?e(B
e$B$N$G$7$g$&$+!#e(B
|locale_charmap e$B$,6uJ8;zNs$rJV$7$?>l9g$K$O!$e(B
|locale e$B$O$I$N$h$&$K2r<a$9$l$PNI$$$G$7$g$&$+!%e(B( “US-ASCII” ? )
|
|e$B$=$b$=$b!$e(Blocale e$B$Ne(B encoding [email protected]$k$N$Ke(B
|Encoding.find(Encoding.locale_charmap) e$B$J$s$F$3$H$r$7$F$$$k$N$,e(B
|e$B:,K\E*$K4*0c$$$r$7$F$$$k$N$G$7$g$&$+!%e(B
e$B%=!<%9$r8+$l$P$o$+$k$h$&$K!"e(Blocale_charmape$B$Oe(Bnile$B$rJV$9$3$H$O$"e(B
e$B$j$($^$9!#$^$?!"e(Bnl_langinfo
e$B$Oe(BEncodinge$B$H$OFHN)$KDj5A$5$l$F$$e(B
e$B$^$9$+$i!“3:Ev$9$ke(BEncodinge$B$,B8:_$7$J$$$3$H$b$”$j$($k$G$7$g$&!#e(B
e$B$$$:$l$K$7$F$b$=$N$h$&$J>l9g$K$Oe(BUS-ASCIIe$B$+e(BASCII-8BITe$B$/$i$$$7e(B
e$B$+;H$($J$$$N$G$O$J$$$G$7$g$&$+!#e(B
e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)