ASCII is alias of US-ASCII; replica of dummy encoding is not a dummy

[email protected]@%$G$9!#e(B

= ASCII is alias of US-ASCII

UTF-{16,32}{BE,LE} e$B$,AH$9~$^$l$?Mm$$G!“e(BNKF
[email protected]$7$F$$$F5$IU$$$?$N$Ge(B
e$B$9$,!”:#e(B ASCII e$B$Oe(B ASCII-8BIT e$B$Ne(B alias
e$B$J$N$G$9$M!#e(BIANA Charaset e$B$G$Oe(B
US-ASCII e$B$Ne(B alias e$B$J$N$G$9$,!">/!9$^$:$/$"$j$^$;$s$+!#e(B

Name: ANSI_X3.4-1968 [RFC1345,KXS2]
MIBenum: 3
Source: ECMA registry
Alias: iso-ir-6
Alias: ANSI_X3.4-1986
Alias: ISO_646.irv:1991
Alias: ASCII
Alias: ISO646-US
Alias: US-ASCII (preferred MIME name)
Alias: us
Alias: IBM367
Alias: cp367
Alias: csASCII

= replica of dummy encoding is not a dummy

e$B<!$K!“e(Bdummy encoding e$B$Ne(B replica e$B$KBP$7$Fe(B
Encoding#dummy? e$B$9$k$He(B false e$B$,e(B
e$BJV$C$F$-$F$7$^$&$N$G$9$,!”$3$l$I$&$7$^$9$+!#e(B

% ruby19 -rnkf -e’p NKF.nkf("–oc=utf-32le-bom",“hoge”).encoding.dummy?’
false
% ruby19 -rnkf -e’p
NKF.nkf("–oc=utf-32le-bom",“hoge”).encoding.base_encoding.dummy?’
true

UTF-32LE-BOM e$B$Oe(B UTF-32 (dummy) e$B$Ne(B replica

e$B0l0F$H$7$F$O!"e(Bset_base_encoding e$B;~$Ke(B base e$B$,e(B dummy
[email protected]$C$?$ie(B replica e$B$be(B
dummy
e$B$K$9$k$H$$$&$b$N$G$9$,!"8F$S=P$7B&$,Cm0U$9$k$Y$-$J5$$b$7$F$$$^$9!#e(B

base e$B$,e(B dummy e$B$Ge(B replica e$B$,e(B dummy

e$B$8$c$J$$>l9g$r5$$K$7$F$$$k$N$G$9$,!"e(B

e$B$=$s$JNc$C$F$"$k$N$G$9$+$M!#e(B

Index: encoding.c

— encoding.c (revision 14957)
+++ encoding.c (working copy)
@@ -207,6 +207,7 @@ set_base_encoding(int index, rb_encoding
VALUE enc = rb_enc_from_encoding(enc_table[index].enc);

 rb_ivar_set(enc, id_base_encoding, rb_enc_from_encoding(base));
  • if (ENC_DUMMY_P(base)) FL_SET(enc, ENC_DUMMY);
    return enc;
    }

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:32992] ASCII is alias of US-ASCII; replica of
dummy encoding is not a dummy”
on Wed, 9 Jan 2008 03:36:27 +0900, “NARUSE, Yui”
[email protected] writes:

|= ASCII is alias of US-ASCII
|
|UTF-{16,32}{BE,LE} e$B$,AH$9~$^$l$?Mm$$G!“e(BNKF [email protected]$7$F$$$F5$IU$$$?$N$Ge(B
|e$B$9$,!”:#e(B ASCII e$B$Oe(B ASCII-8BIT e$B$Ne(B alias e$B$J$N$G$9$M!#e(BIANA Charaset e$B$G$Oe(B
|US-ASCII e$B$Ne(B alias e$B$J$N$G$9$,!">/!9$^$:$/$"$j$^$;$s$+!#e(B

e$B$-$C$HC/$b5$IU$+$J$$$H;W$&$1$I!#[email protected][email protected]*$K0U8+$r;}$D?Me(B
e$B$K$*G$$;$7$^$9!#e(B

|= replica of dummy encoding is not a dummy
|
|e$B<!$K!“e(Bdummy encoding e$B$Ne(B replica e$B$KBP$7$Fe(B Encoding#dummy? e$B$9$k$He(B false e$B$,e(B
|e$BJV$C$F$-$F$7$^$&$N$G$9$,!”$3$l$I$&$7$^$9$+!#e(B

dummye$B$Ne(Breplicae$B$Oe(Bdummye$B$G$"$C$F$[$7$$$G$9$M!#e(B
e$B%3%_%C%H$7$F$/[email protected]$5$$$^$;$s$+!)e(B

At 18:13 08/01/09, Yukihiro M. wrote:

|US-ASCII e$B$Ne(B alias e$B$J$N$G$9$,!">/!9$^$:$/$"$j$^$;$s$+!#e(B

e$B$-$C$HC/$b5$IU$+$J$$$H;W$&$1$I!#[email protected][email protected]*$K0U8+$r;}$D?Me(B
e$B$K$*G$$;$7$^$9!#e(B

e$B5$$,$D$+$J$+$C$?$+$H;W$$$^$9$,!"5$$r$D$+$l$?$N$G!"e(B
IANA Charset Registry e$B$Ne(B Secondary Expert Reviewer
e$B$NN)>l$H$7$Fe(B(http://www.iana.org/numbers.html#C e$B;29Me(B)
[email protected]'HsD>[email protected]$-$?$$$G$9!#e(B
e$B!V$=$A$i$GD>[email protected]$o$l$?$i$3$A$i$G$b$d$j$^$9!#e(B

IANA Charset Registry e$B$b40`z$G$O$J$$$N$O$$$?$$$[$ICN$C$F$$$^$9$7!“e(B
e$B$^$H$b$JM}M3$,$”$C$?$i=>$o$J$$>l9g$b$"$j$H;W$$$^$9$,!"$G$-$k$H$3$m$Oe(B
e$BF1$8$K$7$?J}$,$$$$$H;W$$$^$9!#e(B

e$B59$7$/$*4j$$$7$^$9!#e(B Martin.

#-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-# http://www.sw.it.aoyama.ac.jp mailto:[email protected]

[email protected]@%$G$9!#e(B

Martin D. wrote:

|e$B$9$,!":#e(B ASCII e$B$Oe(B ASCII-8BIT e$B$Ne(B alias e$B$J$N$G$9$M!#e(BIANA Charaset e$B$G$Oe(B
|US-ASCII e$B$Ne(B alias e$B$J$N$G$9$,!">/!9$^$:$/$"$j$^$;$s$+!#e(B

e$B$-$C$HC/$b5$IU$+$J$$$H;W$&$1$I!#[email protected][email protected]*$K0U8+$r;}$D?Me(B
e$B$K$*G$$;$7$^$9!#e(B

e$B5$$,$D$+$J$+$C$?$+$H;W$$$^$9$,!"5$$r$D$+$l$?$N$G!"e(B
IANA Charset Registry e$B$Ne(B Secondary Expert Reviewer e$B$NN)>l$H$7$Fe(B(http://www.iana.org/numbers.html#C e$B;29Me(B) [email protected]'HsD>[email protected]$-$?$$$G$9!#e(B
e$B!V$=$A$i$GD>[email protected]$o$l$?$i$3$A$i$G$b$d$j$^$9!#e(B

e$B$H$$$&$o$1$G!"[email protected]$G$9!#e(B
US-ASCII e$B$O%S%k%H%$%s$G$O$J$$$N$G!"e(Balias
[email protected]$1EPO?$7$F$*$$$F!"8F$P$l$?;~e(B
e$B$KK\BN$rFI$_9~$`;EAH$_e(B (lazy alias)
e$B$r:n$j$^$7$?!#L>A0$b4^$a$F$3$NJ}8~$Ge(B
e$B$h$m$7$$$G$7$g$&$+!#e(B

Index: encoding.c

— encoding.c (revision 14981)
+++ encoding.c (working copy)
@@ -29,6 +29,7 @@ static struct rb_encoding_entry *enc_tab
static int enc_table_count;
static int enc_table_size;
static st_table *enc_table_alias;
+static st_table *enc_table_lazy_alias;

#define ENC_UNINITIALIZED (&rb_cEncoding)
#define enc_initialized_p(enc) ((enc)->auxiliary_data != &rb_cEncoding)
@@ -174,6 +175,7 @@ rb_enc_register(const char *name, rb_enc
if (STRCASECMP(name, rb_enc_name(oldenc))) {
st_data_t key = (st_data_t)name, alias;
st_delete(enc_table_alias, &key, &alias);

  •       st_delete(enc_table_lazy_alias, &key, &alias);
          index = enc_register(name, encoding);
      }
      else if (enc_initialized_p(oldenc) &&
    

@@ -289,6 +291,21 @@ rb_enc_alias(const char *alias, const ch
return enc_alias(alias, orig);
}

+static int
+enc_lazy_alias(const char *alias, const char *orig)
+{

  • int idx;
  • if (!enc_table_lazy_alias) {
  •   enc_table_lazy_alias = st_init_strcasetable();
    
  • }
  • idx = rb_enc_registered(alias);
  • if (idx < 0) {
  •   st_insert(enc_table_lazy_alias, (st_data_t)alias, 
    

(st_data_t)orig);

  • }
  • return idx;
    +}

enum {
ENCINDEX_ASCII,
ENCINDEX_EUC_JP,
@@ -307,7 +324,7 @@ rb_enc_init(void)
ENC_REGISTER(SJIS);
ENC_REGISTER(UTF8);
#undef ENC_REGISTER

  • enc_alias(“ASCII”, rb_enc_name(ONIG_ENCODING_ASCII));
  • enc_lazy_alias(“ASCII”, “US-ASCII”);
    enc_alias(“BINARY”, rb_enc_name(ONIG_ENCODING_ASCII));
    enc_alias(“eucJP”, rb_enc_name(ONIG_ENCODING_EUC_JP)); /* UI-OSF
    Application Platform Profile f
    or Japanese Environment Version 1.1 */
    enc_alias(“SJIS”, rb_enc_name(ONIG_ENCODING_SJIS));
    @@ -371,8 +388,14 @@ rb_enc_find_index(const char *name)
    ++s;
    }
    OBJ_FREEZE(enclib);
  •   if (RTEST(rb_protect(require_enc, enclib, 0)))
    
  •   if (RTEST(rb_protect(require_enc, enclib, 0))) {
          i = rb_enc_registered(name);
    
  •   } else {
    
  •       st_data_t orig;
    
  •       if (st_lookup(enc_table_lazy_alias, (st_data_t)name, &orig)) 
    

{

  •           i = rb_enc_alias(name, (char *)orig);
    
  •       }
    
  •   }
      rb_set_errinfo(Qnil);
    
    }
    return i;

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33011] Re: ASCII is alias of US-ASCII; replica
of dummy encoding is not a dummy”
on Fri, 11 Jan 2008 09:36:52 +0900, “NARUSE, Yui”
[email protected] writes:

|e$B$H$$$&$o$1$G!"[email protected]$G$9!#e(B
|US-ASCII e$B$O%S%k%H%$%s$G$O$J$$$N$G!"e(Balias [email protected]$1EPO?$7$F$*$$$F!"8F$P$l$?;~e(B
|e$B$KK\BN$rFI$_9~$`;EAH$_e(B (lazy alias) e$B$r:n$j$^$7$?!#L>A0$b4^$a$F$3$NJ}8~$Ge(B
|e$B$h$m$7$$$G$7$g$&$+!#e(B

e$B$J$k$[$I!#$3$N<~JU$G5$$K$J$C$F$$$k$N$O0J2<$N$3$H$G$9!#e(B

US-ASCIIe$B$He(BASCIIe$B$N$h$&$KF0E*%m!<%I$5$l$k%(%s%3!<%G%#%s%0$Ne(B
e$BJLL>$r$I$&$9$k$Y$-$+e(B(e$BB>$K$Oe(BISO-8859-1e$B$He(BLatin-1)e$B$H$+!#%a%se(B
e$B%F%J%s%[email protected]$&$HJLL>Dj5A$Oe(Bence$B0J2<$N%i%$%V%i%j$Ke(B
e$B$^$H$a$?$$$1$I!"%m!<%I$7$J$$$HJLL>$,;H$($J$$$h$&$G$O:$$ke(B
e$B$7!#e(B

  • Encoding.liste$B$O8=:_%m!<%I$5$l$F$$$k%(%s%3!<%G%#%s%0e(B(e$B$NK\e(B
    e$BL>e(B)e$B$r%j%9%H$9$k$o$1$G$9$,!“JLL>$d$^[email protected]%m!<%I$5$l$F$$$J$$%(e(B
    e$B%s%3!<%G%#%s%0$NL>A0$bCN$j$?$$$H$$$&%K!<%:$,e(BDave
    Thomase$B$+e(B
    e$B$i<($5$l$F$$$^$9e(B[ruby-core:14936]e$B!#$^$?!”$=$l$,$G$-$J$$$/e(B
    e$B$i$$$J$i$$$C$=e(BEncoding.liste$B$O:o$C$?J}$,$h$$$N$G$O!"$H$be(B
    [ruby-core:14947]e$B!#e(B

e$B$I$&;W$$$^$9$+!)e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

[email protected]@%$G$9!#e(B

Yukihiro M. wrote:

|= ASCII is alias of US-ASCII
|
|UTF-{16,32}{BE,LE} e$B$,AH$9~$^$l$?Mm$$G!“e(BNKF [email protected]$7$F$$$F5$IU$$$?$N$Ge(B
|e$B$9$,!”:#e(B ASCII e$B$Oe(B ASCII-8BIT e$B$Ne(B alias e$B$J$N$G$9$M!#e(BIANA Charaset e$B$G$Oe(B
|US-ASCII e$B$Ne(B alias e$B$J$N$G$9$,!">/!9$^$:$/$"$j$^$;$s$+!#e(B

e$B$-$C$HC/$b5$IU$+$J$$$H;W$&$1$I!#[email protected][email protected]*$K0U8+$r;}$D?Me(B
e$B$K$*G$$;$7$^$9!#e(B

e$B$o$?$7$,5$$E$$$?$-$C$+$1$O!"e(BNKF::ASCII e$B$re(B
rb_enc_find_index(“ASCII”) e$B$Ge(B
e$BDj5A$7$F$$$?$ie(B ASCII-8BIT e$B$,F~$C$F$7$^$C$?$3$H$G$9$M!#e(B
e$B$3$l<+BN$Oe(B “US-ASCII”
e$B$G<[email protected]$1$N$3$H$J$N$G$9$,!"F1$8$h$&$K$O$^$ke(B
e$B?M$O$A$i$[$i$H$$$=$&[email protected]$J$!$H!#e(B

|= replica of dummy encoding is not a dummy
|
|e$B<!$K!“e(Bdummy encoding e$B$Ne(B replica e$B$KBP$7$Fe(B Encoding#dummy? e$B$9$k$He(B false e$B$,e(B
|e$BJV$C$F$-$F$7$^$&$N$G$9$,!”$3$l$I$&$7$^$9$+!#e(B

dummye$B$Ne(Breplicae$B$Oe(Bdummye$B$G$"$C$F$[$7$$$G$9$M!#e(B
e$B%3%_%C%H$7$F$/[email protected]$5$$$^$;$s$+!)e(B

r14969 e$B$G%3%_%C%H$7$^$7$?!#e(B

[email protected]@%$G$9!#e(B

Yukihiro M. wrote:

e$B$J$k$[$I!#$3$N<~JU$G5$$K$J$C$F$$$k$N$O0J2<$N$3$H$G$9!#e(B
e$B$i<($5$l$F$$$^$9e(B[ruby-core:14936]e$B!#$^$?!"$=$l$,$G$-$J$$$/e(B
e$B$i$$$J$i$$$C$=e(BEncoding.liste$B$O:o$C$?J}$,$h$$$N$G$O!"$H$be(B
[ruby-core:14947]e$B!#e(B

e$B$I$&;W$$$^$9$+!)e(B

= Encoding.list

e$B$^$:;EMM$+$iF~$j$^$9$H!"e(BEncoding.list
e$B$O$d$C$Q$jM_$7$$$G$9$h$M!#$3$3$KL$e(B
e$B%m!<%I$N%(%s%3!<%G%#%s%0$NK\L>$b4^$a$k$3$H$O0[[email protected]$,$J$$$H;W$$$^$9!#e(B

e$BG:$^$7$$$N$Oe(B alias e$B$r$I$&$9$k$+$G$7$g$&$+!#e(Blibiconv
e$B$N;~$Ne(B Iconv.list e$B$Oe(B
e$BK\L>$HJLL>$N%0%k!<%W$rG[Ns$K$7$F!"A4BN$rFs=EG[Ns$K$7$F$$$^$9$,!"e(B
alias_list e$B$H$$$&JL$N%a%=%C%I$r:n$C$F!"JLL>e(B => e$BK\L>e(B
e$B$N%O%C%7%e$rJV$9$N$be(B
e$B$$$$$N$G$O$J$$$+$H;W$C$F$$$^$9!#e(B

= e$BJLL>$NDj5Ae(B

e$B$I$3$GDj5A$9$k$N$,0lHV%a%s%F$7$d$9$$$+$H$$$($P!"e(Benc/*.c e$B$Ne(B
OnigEncodingDefine()
e$B$N8e$GJLL>$bDj5A$7$F$7$^$&$H$$$&$3$H$K$J$k$N$G$O$Je(B
e$B$$$G$7$g$&$+!#e(B

e$B8e$O%S%k%I;~$Ke(B enc/make_encmake.rb
e$B$G$=$l$>$l$N%U%!%$%k$r8+$F$^$o$C$F!“e(B
e$B$”$i$+$8$a%(%s%3!<%G%#%s%0L>$HJLL>$N%F!<%V%k$rMQ0U$7$F$*$1$P$h$$$+$H!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33014] Re: ASCII is alias of US-ASCII; replica
of dummy encoding is not a dummy”
on Fri, 11 Jan 2008 14:54:43 +0900, “NARUSE, Yui”
[email protected] writes:

|= Encoding.list
|
|e$B$^$:;EMM$+$iF~$j$^$9$H!"e(BEncoding.list e$B$O$d$C$Q$jM_$7$$$G$9$h$M!#$3$3$KL$e(B
|e$B%m!<%I$N%(%s%3!<%G%#%s%0$NK\L>$b4^$a$k$3$H$O0[[email protected]$,$J$$$H;W$$$^$9!#e(B

e$B!Ve(Bliste$B$,$[$7$$!W$H$$$&$N$OJ,$+$j$^$9!#$[$7$$$N$Oe(B

  • encodinge$BL>$H$7$F;XDj$G$-$k$9$Y$F$NL>A0$N%j%9%He(B
  • [email protected]<0$Je(Bencoidnge$BL>$N%j%9%He(B(e$BJLL>=|$/e(B)

e$B$N$I$A$i$J$s$G$7$g$&$M!#$$$d!“N>J}$H$b$=$l$>$l$[$7$$;~$,$”$ke(B
e$B$G$7$g$&$,!"$I$A$i$,B?$$$N$+!"$H$$$&0UL#$G!#A0<T$,B?$$$N$G$"e(B
e$B$l$P!“e(Bliste$B$OA0<T$rDs6!$9$Y$-$G$7$g$&$7!“8e<T$,B?$$$N$G$”$l$Pe(B
liste$B$O$=$N$h$&$K$7$F!”$=$l$O$=$l$H$7$FA0<[email protected]$kJ}K!$rDs6!$9e(B
e$B$Y$-$G$7$g$&!#$J$s$H$J$/A0<T$N$h$&$J5$$,$9$k$s$G$9$,e(B(e$B$3$l$Oe(B
iconve$B%3%^%s%I$Ne(B-le$B%*%W%7%g%s$+$i$NN`?de(B)e$B!#e(B

|e$BG:$^$7$$$N$Oe(B alias e$B$r$I$&$9$k$+$G$7$g$&$+!#e(Blibiconv e$B$N;~$Ne(B Iconv.list e$B$Oe(B
|e$BK\L>$HJLL>$N%0%k!<%W$rG[Ns$K$7$F!"A4BN$rFs=EG[Ns$K$7$F$$$^$9$,!"e(B
|alias_list e$B$H$$$&JL$N%a%=%C%I$r:n$C$F!"JLL>e(B => e$BK\L>e(B e$B$N%O%C%7%e$rJV$9$N$be(B
|e$B$$$$$N$G$O$J$$$+$H;W$C$F$$$^$9!#e(B

e$B$=$l$O$$$$$+$b$7$l$^$;$s$M!#e(B

|= e$BJLL>$NDj5Ae(B
|
|e$B$I$3$GDj5A$9$k$N$,0lHV%a%s%F$7$d$9$$$+$H$$$($P!"e(Benc/.c e$B$Ne(B
|OnigEncodingDefine() e$B$N8e$GJLL>$bDj5A$7$F$7$^$&$H$$$&$3$H$K$J$k$N$G$O$Je(B
|e$B$$$G$7$g$&$+!#e(B
|
|e$B8e$O%S%k%I;~$Ke(B enc/make_encmake.rb e$B$G$=$l$>$l$N%U%!%$%k$r8+$F$^$o$C$F!“e(B
|e$B$”$i$+$8$a%(%s%3!<%G%#%s%0L>$HJLL>$N%F!<%V%k$rMQ0U$7$F$
$1$P$h$$$+$H!#e(B

e$BC/$+$=$&$$$&$N:n$C$F$/$l$k?M!"$$$^$;$s$+!)e(B

                                    e$B$^$D$b$He(B e$B$f$-$R$me(B
                                    /:|)

[email protected]$G$9!#e(B

At Fri, 11 Jan 2008 10:03:33 +0900,
Yukihiro M. wrote in [ruby-dev:33012]:

e$B%s%3!<%G%#%s%0$NL>A0$bCN$j$?$$$H$$$&%K!<%:$,e(BDave T.e$B$+e(B
e$B$i<($5$l$F$$$^$9e(B[ruby-core:14936]e$B!#$^$?!"$=$l$,$G$-$J$$$/e(B
e$B$i$$$J$i$$$C$=e(BEncoding.liste$B$O:o$C$?J}$,$h$$$N$G$O!"$H$be(B
[ruby-core:14947]e$B!#e(B

e$B$I$&;W$$$^$9$+!)e(B

e$BLdBj$Oe(B

  • e$BJLL>$rEPO?$7$?$H$-$K%*%j%8%J%k$b%m!<%I$5$l$F$7$^$&!#e(B

Ce$B%l%Y%ke(B(e$BK\BN$+3HD%%i%$%V%i%je(B)e$B$G$7$+JLL>$,Dj5A$G$-$J$$!#e(B

e$B$H$$$&$H$3$m$K$"$k$H;W$$$^$9!#$H$$$&$3$H$G!"e(B

  • e$B%%j%8%J%k$N%m!<%I$r<B:]$K;2>H$5$l$k$^$Ge(B(e$B6qBNE$K$Oe(B
    rb_to_encoding() e$B$,8F$P$l$k$^$Ge(B)e$BCY1d$9$k!#e(B

  • Encoding.aliase$B$de(BEncoding.replicatee$B$rDI2C$9$k!#e(B

e$B$H$$$&$3$H$r9M$($F$$$^$7$?!#$3$&$9$l$P!“JLL>$O$”$i$+$8$a%i%$%V%ie(B
e$B%je(B(enc/alias.rbe$B$H$+e(Benc.rb)e$B$GEPO?$7$F$*$1$P$$$$$H;W$$$^$9!#e(B

[email protected]$G$9!#e(B

At Fri, 11 Jan 2008 16:07:51 +0900,
Yukihiro M. wrote in [ruby-dev:33015]:

e$B$N$I$A$i$J$s$G$7$g$&$M!#$$$d!“N>J}$H$b$=$l$>$l$[$7$$;~$,$”$ke(B
e$B$G$7$g$&$,!"$I$A$i$,B?$$$N$+!"$H$$$&0UL#$G!#A0<T$,B?$$$N$G$"e(B
e$B$l$P!“e(Bliste$B$OA0<T$rDs6!$9$Y$-$G$7$g$&$7!“8e<T$,B?$$$N$G$”$l$Pe(B
liste$B$O$=$N$h$&$K$7$F!”$=$l$O$=$l$H$7$FA0<[email protected]$kJ}K!$rDs6!$9e(B
e$B$Y$-$G$7$g$&!#$J$s$H$J$/A0<T$N$h$&$J5$$,$9$k$s$G$9$,e(B(e$B$3$l$Oe(B
iconve$B%3%^%s%I$Ne(B-le$B%*%W%7%g%s$+$i$NN`?de(B)e$B!#e(B

e$B$3$3$GJLL>$H$$$C$F$$$k$N$O!“e(Breplicae$B$N$3$H$G$9$+e(B?
Encoding.liste$B$,e(B
e$BJV$9$N$Oe(BEncodinge$B%*%V%8%’%/%H$N%j%9%H$G$9$+$i!“e(Baliase$B$O$=$b$=$b0Ue(B
e$BL#$r;}$A$^$;$s$,!”$3$3$Ge(Breplicae$B$H$=$l0J30!”$?$H$($Pe(BShift_JISe$B$He(B
Windows-31Je$B$r6hJL$9$kI,MW$O$"$k$N$G$7$g$&$+!#e(B

|e$BG:$^$7$$$N$Oe(B alias e$B$r$I$&$9$k$+$G$7$g$&$+!#e(Blibiconv e$B$N;~$Ne(B Iconv.list e$B$Oe(B
|e$BK\L>$HJLL>$N%0%k!<%W$rG[Ns$K$7$F!"A4BN$rFs=EG[Ns$K$7$F$$$^$9$,!"e(B
|alias_list e$B$H$$$&JL$N%a%=%C%I$r:n$C$F!"JLL>e(B => e$BK\L>e(B e$B$N%O%C%7%e$rJV$9$N$be(B
|e$B$$$$$N$G$O$J$$$+$H;W$C$F$$$^$9!#e(B

e$B$=$l$O$$$$$+$b$7$l$^$;$s$M!#e(B

e$B$I$C$A$+$H$$$&$He(B alias => Encodinge$B%*%V%8%’%/%He(B
e$B$G$7$g$&$+!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33016] Re: ASCII is alias of US-ASCII; replica
of dummy encoding is not a dummy”
on Fri, 11 Jan 2008 16:38:05 +0900, Nobuyoshi N.
[email protected] writes:

|> e$B$N$I$A$i$J$s$G$7$g$&$M!#$$$d!“N>J}$H$b$=$l$>$l$[$7$$;~$,$”$ke(B
|> e$B$G$7$g$&$,!"$I$A$i$,B?$$$N$+!"$H$$$&0UL#$G!#A0<T$,B?$$$N$G$“e(B
|> e$B$l$P!“e(Bliste$B$OA0<T$rDs6!$9$Y$-$G$7$g$&$7!“8e<T$,B?$$$N$G$”$l$Pe(B
|> liste$B$O$=$N$h$&$K$7$F!”$=$l$O$=$l$H$7$FA0<[email protected]$kJ}K!$rDs6!$9e(B
|> e$B$Y$-$G$7$g$&!#$J$s$H$J$/A0<T$N$h$&$J5$$,$9$k$s$G$9$,e(B(e$B$3$l$Oe(B
|> iconve$B%3%^%s%I$Ne(B-le$B%%W%7%g%s$+$i$NN`?de(B)e$B!#e(B
|
|e$B$3$3$GJLL>$H$$$C$F$$$k$N$O!"e(Breplicae$B$N$3$H$G$9$+e(B? Encoding.liste$B$,e(B
|e$BJV$9$N$Oe(BEncodinge$B%
%V%8%’%/%H$N%j%9%H$G$9$+$i!“e(Baliase$B$O$=$b$=$b0Ue(B
|e$BL#$r;}$A$^$;$s$,!”$3$3$Ge(Breplicae$B$H$=$l0J30!”$?$H$($Pe(BShift_JISe$B$He(B
|Windows-31Je$B$r6hJL$9$kI,MW$O$"$k$N$G$7$g$&$+!#e(B

e$B$"!<!"$=$&[email protected]$C$?e(B >
Encodinge$B%*%V%8%’%/%H$N%j%9%H$G$9$+$i!"e(Baliase$B$O$=$b$=$b0UL#$r;}$A$^$;$se(B

e$B$s$G$O!"e(B

  • liste$B$O%m!<%I$G$-$k$9$Y$F$N%(%s%3!<%G%#%s%0$N%j%9%He(B
  • e$B<u$1IU$1$i$l$k$9$Y$F$N%(%s%3!<%G%#%s%0L>$N%j%9%He(B

e$B$NN>J}$,$[$7$$$N$G$O$J$$$+!"$H$$$&$3$H$G!#e(B

|e$B$I$C$A$+$H$$$&$He(B alias => Encodinge$B%*%V%8%’%/%He(B e$B$G$7$g$&$+!#e(B

e$B$=$l$O$=$l$G4r$7$$$H;W$$$^$9!#e(B

e$B7k6Ie(B3e$B$D$N%a%=%C%I$,$$$k$N$+!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

[email protected]@%$G$9!#e(B

Yukihiro M. wrote:

|e$B8e$O%S%k%I;~$Ke(B enc/make_encmake.rb e$B$G$=$l$>$l$N%U%!%$%k$r8+$F$^$o$C$F!“e(B
|e$B$”$i$+$8$a%(%s%3!<%G%#%s%0L>$HJLL>$N%F!<%V%k$rMQ0U$7$F$*$1$P$h$$$+$H!#e(B

e$BC/$+$=$&$$$&$N:n$C$F$/$l$k?M!"$$$^$;$s$+!)e(B

e$B$o$?$7$,:n$k$3$H$rA0Ds$K=q$$$F$^$7$?!#$H$j$"$($:F0$/$b$N$rMQ0U$7$^$9!#e(B

[email protected]@%$G$9!#e(B

Nobuyoshi N. wrote:

e$B$3$3$GJLL>$H$$$C$F$$$k$N$O!“e(Breplicae$B$N$3$H$G$9$+e(B? Encoding.liste$B$,e(B
e$BJV$9$N$Oe(BEncodinge$B%*%V%8%’%/%H$N%j%9%H$G$9$+$i!“e(Baliase$B$O$=$b$=$b0Ue(B
e$BL#$r;}$A$^$;$s$,!”$3$3$Ge(Breplicae$B$H$=$l0J30!”$?$H$($Pe(BShift_JISe$B$He(B
Windows-31Je$B$r6hJL$9$kI,MW$O$"$k$N$G$7$g$&$+!#e(B

e$B$"$"$"!"3N$+$K$4$b$C$H$b!"e(Balias e$B$O$b$H$h$jF~$j$^$;$s$M!#e(B

Yukihiro M. wrote:

  • liste$B$O%m!<%I$G$-$k$9$Y$F$N%(%s%3!<%G%#%s%0$N%j%9%He(B
  • e$B<u$1IU$1$i$l$k$9$Y$F$N%(%s%3!<%G%#%s%0L>$N%j%9%He(B

e$B$NN>J}$,$[$7$$$N$G$O$J$$$+!"$H$$$&$3$H$G!#e(B

|e$B$I$C$A$+$H$$$&$He(B alias => Encodinge$B%*%V%8%’%/%He(B e$B$G$7$g$&$+!#e(B

e$B$=$l$O$=$l$G4r$7$$$H;W$$$^$9!#e(B

e$B7k6Ie(B3e$B$D$N%a%=%C%I$,$$$k$N$+!#e(B

Encoding e$B%%V%8%’%/%H$Ne(B array e$B$rJV$9e(B Encoding.list
e$B$H!"e(B
e$B%(%s%3!<%G%#%s%0L>e(B (string) => Encoding e$B%
%V%8%’%/%He(B
e$B$Ne(B hash e$B$rJV$9e(B
Encoding.name_list e$B$J$j$Ne(B2e$B$D$G$h$5$=$&$J5$$,$7$^$9!#e(B

In article [email protected]in.invalid,
“NARUSE, Yui” [email protected] writes:

e$B%(%s%3!<%G%#%s%0L>e(B (string) => Encoding e$B%*%V%8%’%/%He(B e$B$Ne(B hash e$B$rJV$9e(B
Encoding.name_list e$B$J$j$Ne(B2e$B$D$G$h$5$=$&$J5$$,$7$^$9!#e(B

Encoding.name_list e$B$C$F8F$S=P$7$?;[email protected]$G%(%s%3!<%G%#%s%0$r$<e(B
e$B$s$Ve(B load e$B$9$k$s$G$9$+e(B?

e$BL>A0$N$[$&$,L5Fq$8$c$"$j$^$;$se(B?

Encoding.aliases e$B$H$+!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33022] Re: ASCII is alias of US-ASCII; replica
of dummy encoding is not a dummy”
on Fri, 11 Jan 2008 18:34:39 +0900, “NARUSE, Yui”
[email protected] writes:

|> e$B7k6Ie(B3e$B$D$N%a%=%C%I$,$$$k$N$+!#e(B
|
|Encoding e$B%%V%8%’%/%H$Ne(B array e$B$rJV$9e(B Encoding.list e$B$H!"e(B
|e$B%(%s%3!<%G%#%s%0L>e(B (string) => Encoding e$B%
%V%8%’%/%He(B e$B$Ne(B hash e$B$rJV$9e(B
|Encoding.name_list e$B$J$j$Ne(B2e$B$D$G$h$5$=$&$J5$$,$7$^$9!#e(B

e$BI,MW$J$N$Oe(B

(1) e$B%m!<%I$5$l$F$$$ke(B Encoding e$B%*%V%8%’%/%H$Ne(B array
e$B$rJV$9e(B
Encoding.list
(2) e$BMxMQ2DG=$Je(BEncodinge$BL>$NG[Ns$rJV$9e(BEncoding.name_list
(3)
e$BMxMQ2DG=$Je(Baliase$B$rI=8=$9$ke(BEncoding.aliases(e$BL>A0$+$iL>A0$Xe(B
e$B$Ne(Bhashe$B$rJV$9e(B)e$B!#e(B

e$B$Ne(B3e$B$D$8$c$J$$$+$H;W$$$^$9!#M%@h=g0L$Oe(B(2)e$B"*e(B(1)e$B"*e(B(3)e$B$+$J!#e(B
(3)e$B$O$J$/$F$b$$$$$+$b!#e(B

[email protected]@%$G$9!#e(B

Tanaka A. wrote:

Encoding.aliases e$B$H$+!#e(B

e$B$(!"$($C$H!"e(B[ruby-dev:33013] e$B$N!"e(B

  • e$B%%j%8%J%k$N%m!<%I$r<B:]$K;2>H$5$l$k$^$Ge(B(e$B6qBNE$K$Oe(B
    rb_to_encoding() e$B$,8F$P$l$k$^$Ge(B)e$BCY1d$9$k!#e(B
    e$B$,E,MQ$5$l$F$$$k$3$H$,A0Ds$H$$$&$3$H$G!#e(B

e$B%S%k%H%$%[email protected]$H$+%m!<%I:[email protected]$H$+$N35G0$rK:$l$i$l$k$N$O%a%j%C%H$+$J$!$He(B
e$B;W$C$?$N$G$9$,!#[email protected]$1$N$?$a$K%(%s%3!<%G%#%s%[email protected]$1%*%V%8%’%/%H;}$De(B
e$B$N$OL5BL$G$9$+$M$’!#e(B

e$B%m!<%ICY1d$,F~$i$J$1$l$Pe(B [ruby-dev:33026] e$B$NDL$je(B 3
e$B$DI,MW$K$J$k$H;W$$$^$9!#e(B

成瀬です。

Yukihiro M. wrote:

|= 別名の定義
|
|どこで定義するのが一番メンテしやすいかといえば、enc/*.c の
|OnigEncodingDefine() の後で別名も定義してしまうということになるのではな
|いでしょうか。
|
|後はビルド時に enc/make_encmake.rb でそれぞれのファイルを見てまわって、
|あらかじめエンコーディング名と別名のテーブルを用意しておけばよいかと。

誰かそういうの作ってくれる人、いませんか?

これと

必要なのは

(1) ロードされている Encoding オブジェクトの array を返す
Encoding.list
(2) 利用可能なEncoding名の配列を返すEncoding.name_list
(3) 利用可能なaliasを表現するEncoding.aliases(名前から名前へ
のhashを返す)。

の3ã¤ã˜ã‚ƒãªã„ã‹ã¨æ€ã„ã¾ã™ã€‚å„ªå…ˆé †ä½ã¯(2)→(1)→(3)かな。
(3)はなくてもいいかも。

と、

[ruby-dev:32992] の “ASCII” ã‚’ ASCII-8BIT ではなく US-ASCII の alias に
するパッチです。このパッチで SJIS と EUCJP をビルトインから外せると思う
のですがどうしましょう。

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33067] Re: ASCII is alias of US-ASCII; replica
of dummy encoding is not a dummy”
on Sat, 12 Jan 2008 21:58:48 +0900, “NARUSE, Yui”
[email protected] writes:

|> |e$B$I$3$GDj5A$9$k$N$,0lHV%a%s%F$7$d$9$$$+$H$$$($P!“e(Benc/.c e$B$Ne(B
|> |OnigEncodingDefine() e$B$N8e$GJLL>$bDj5A$7$F$7$^$&$H$$$&$3$H$K$J$k$N$G$O$Je(B
|> |e$B$$$G$7$g$&$+!#e(B
|> |
|> |e$B8e$O%S%k%I;~$Ke(B enc/make_encmake.rb e$B$G$=$l$>$l$N%U%!%$%k$r8+$F$^$o$C$F!“e(B
|> |e$B$”$i$+$8$a%(%s%3!<%G%#%s%0L>$HJLL>$N%F!<%V%k$rMQ0U$7$F$
$1$P$h$$$+$H!#e(B
|>
|> e$BC/$+$=$&$$$&$N:n$C$F$/$l$k?M!”$$$^$;$s$+!)e(B
|
|e$B$3$l$He(B
|
|> e$BI,MW$J$N$Oe(B
|>
|> (1) e$B%m!<%I$5$l$F$$$ke(B Encoding e$B%*%V%8%’%/%H$Ne(B array e$B$rJV$9e(B
|> Encoding.list
|> (2) e$BMxMQ2DG=$Je(BEncodinge$BL>$NG[Ns$rJV$9e(BEncoding.name_list
|> (3) e$BMxMQ2DG=$Je(Baliase$B$rI=8=$9$ke(BEncoding.aliases(e$BL>A0$+$iL>A0$Xe(B
|> e$B$Ne(Bhashe$B$rJV$9e(B)e$B!#e(B
|>
|> e$B$Ne(B3e$B$D$8$c$J$$$+$H;W$$$^$9!#M%@h=g0L$Oe(B(2)e$B"*e(B(1)e$B"*e(B(3)e$B$+$J!#e(B
|> (3)e$B$O$J$/$F$b$$$$$+$b!#e(B
|
|e$B$H!"e(B
|
|[ruby-dev:32992] e$B$Ne(B “ASCII” e$B$re(B ASCII-8BIT e$B$G$O$J$/e(B US-ASCII e$B$Ne(B alias e$B$Ke(B
|e$B$9$k%Q%C%A$G$9!#$3$N%Q%C%A$Ge(B SJIS e$B$He(B EUCJP e$B$r%S%k%H%$%s$+$i30$;$k$H;W$&e(B
|e$B$N$G$9$,$I$&$7$^$7$g$&!#e(B

e$BNI$$$s$8$c$J$$$+$H;W$$$^$9!#e(BSJISe$B$He(BEUCJPe$B$r30$9$N$O!"e(Brubye$B$N%5e(B
e$B%$%:$,>.$5$/$J$j$^$9$7!"F|K\Cf?4$H1"8}[email protected]$,8:$je(B
e$B$^$9$N$G!"K>$^$7$$$H;W$$$^$9!#e(B

e$B%3%_%C%[email protected]$1$^$;$s$+!#e(Bmake_encdb.rbe$B$rK:$l$:$K!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs