Encoding of strings that pack format 'm' and 'M' generates


#1

Yuguie$B$G$9!#e(B

Array#packe$B$K$*$$$F!"e(Bquoted-printable (‘M’)e$B$He(Bbase64
(‘m’)e$B$Ge(Bpacke$B$5$l$?J8;ze(B
e$BNs$N%(%s%3!<%G%#%s%0$,e(BASCII-8BITe$B$J$N$O0U?^$5$l$?5sF0$G$7$g$&$+e(B?

e$B$3$l$i$N%U%)!<%^%C%H$N@-e!"e(BUS-ASCIIe$B$G$bNI$$$H;W$$$^$9!#e(B


#2

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

In message “Re: [ruby-dev:37286] Re: encoding of strings that pack
format ‘m’ and ‘M’ generates”
on Sat, 6 Dec 2008 14:20:20 +0900, “NARUSE, Yui” removed_email_address@domain.invalid
writes:

|Yugui (Yuki S.) wrote:
|> Array#packe$B$K$*$$$F!"e(Bquoted-printable (‘M’)e$B$He(Bbase64 (‘m’)e$B$Ge(Bpacke$B$5$l$?J8;ze(B
|> e$BNs$N%(%s%3!<%G%#%s%0$,e(BASCII-8BITe$B$J$N$O0U?^$5$l$?5sF0$G$7$g$&$+e(B?
|>
|> e$B$3$l$i$N%U%)!<%^%C%H$N@-e!“e(BUS-ASCIIe$B$G$bNI$$$H;W$$$^$9!#e(B
|
|e$B$D$$$G$Ke(B CODERANGE e$B$b@_Dj$7$F!”$3$s$J46$8$G$9$+$M$’!#e(B

e$B$G$9$M!#%3%_%C%H$7$F$$$?$@$1$^$;$s$+!)e(B


#3

e$B@.@%$G$9!#e(B

Yugui (Yuki S.) wrote:

Array#packe$B$K$*$$$F!"e(Bquoted-printable (‘M’)e$B$He(Bbase64 (‘m’)e$B$Ge(Bpacke$B$5$l$?J8;ze(B
e$BNs$N%(%s%3!<%G%#%s%0$,e(BASCII-8BITe$B$J$N$O0U?^$5$l$?5sF0$G$7$g$&$+e(B?

e$B$3$l$i$N%U%)!<%^%C%H$N@-e!"e(BUS-ASCIIe$B$G$bNI$$$H;W$$$^$9!#e(B

e$B$D$$$G$Ke(B CODERANGE e$B$b@_Dj$7$F!"$3$s$J46$8$G$9$+$M$’!#e(B

Index: pack.c

— pack.c (revision 20562)
+++ pack.c (working copy)
@@ -921,6 +921,7 @@ pack_pack(VALUE ary, VALUE fmt)
plen -= todo;
ptr += todo;
}

  •       ENCODING_CODERANGE_SET(res, rb_usascii_encindex(), 
    

ENC_CODERANGE_7BIT);
break;

      case 'M':             /* quoted-printable encoded string */

@@ -928,6 +929,7 @@ pack_pack(VALUE ary, VALUE fmt)
if (len <= 1)
len = 72;
qpencode(res, from, len);

  •       ENCODING_CODERANGE_SET(res, rb_usascii_encindex(), 
    

ENC_CODERANGE_7BIT);
break;

      case 'P':             /* pointer to packed byte string */

@@ -1886,6 +1888,7 @@ pack_unpack(VALUE str, VALUE fmt)
}
}
rb_str_set_len(buf, ptr - RSTRING_PTR(buf));

  •           ENCODING_CODERANGE_SET(buf, rb_usascii_encindex(), 
    

ENC_CODERANGE_7BIT);
UNPACK_PUSH(buf);
}
break;
@@ -1914,6 +1917,7 @@ pack_unpack(VALUE str, VALUE fmt)
s++;
}
rb_str_set_len(buf, ptr - RSTRING_PTR(buf));

  •           ENCODING_CODERANGE_SET(buf, rb_usascii_encindex(), 
    

ENC_CODERANGE_7BIT);
UNPACK_PUSH(buf);
}
break;