Can't use "|" in open-uri

e$BFb3$$H?=$7$^$9!#$O$8$a$^$7$F!#e(B

open-uri e$B$G;HMQ$9$kJ8;zNs$Ke(B “|” e$B$,4^$^$l$F$$$k$H!"e(B
bad URI e$B$HI=<($5$l$F=*N;$7$F$7$^$$$^$9!#e(B

e$B;d$Oe(B Yahoo!e$B%G%Y%m%C%Q!<%M%C%H%o!<%/$Ne(B
e$B!VF|K\8l7ABVAG2r@Oe(BWebe$B%5!<%S%9!W$rMxMQ$7$F$$$k$N$G$9$,!“e(B
e$B$3$NCf$G$Oe(B URL e$B$Ke(B “|” e$B$r;HMQ$9$k%1!<%9$,$”$j$^$9!#e(B
http://developer.yahoo.co.jp/jlp/MAService/V1/parse.html

e$BNc$($P!V%F%9%H$G$9!W$H$$$&J8>O$r2r@O$7$Fe(B
e$BL>;l$H=uF0;l$r<h$j=P$9>l9g$O!"e(B
e$B<!$Ne(B URL e$B$r%j%/%(%9%H$9$k$3$H$K$J$j$^$9!#e(B
http://api.jlp.yahoo.co.jp/MAService/V1/parse?appid=YahooDemo&results=ma&filter
=9|12&sentence=e$B%F%9%H$G$9e(B
“filter=9|12” e$B$N$H$3$m$Ge(B “|” e$B$r;H$C$F$$$^$9!#e(B

e$BBP=hK!$r8!:w$7$?$H$3$m!“<!$N$h$&$J5-=R$,$”$j$^$7$?!#e(B
http://www.adamrocker.com/blog/120/ruby_open_uri_parser_error.html
//
e$B$I$&$d$ie(Bopen-urie$B$Ne(BURIe$B$N%Q!<%9$K$Oe(BURIe$B%i%$%V%i%j$rMxMQ$7$F$$$k$H$N;v!#e(B
e$B$H$$$&$3$H$G!“e(BURIe$B%i%$%V%i%j$N%=!<%9$rD/$a$F$_$^$7$?!#e(B
e$B$9$k$He(Buri/common.rbe$B$Ne(B39e$B9TL$K0J2<$N5-=R$,$”$j$^$7$?!#e(B
RESERVED = “;/?:@&=+$,??[??]”

e$BFb3$Cme(B: ruby 1.8.6-p111 e$B$G$O<!$N$h$&$K$J$C$F$$$^$9!#e(B

RESERVED = “;/?:@&=+$,\[\]”

e$B$3$l$Oe(BURIe$B$r%Q!<%9$9$k;~$KM=Ls8l$H$J$kJ8;zNs=89g$J$N$G$9$,!“e(B
e$B$3$3$K!Ve(B|e$B!W$,4^$^$l$F$$$J$$!#e(B
e$B$J$k$[$I!”$3$l$O%Q!<%9$G$-$^$;$s!#e(B
e$B$H$$$&$3$H$G!"$3$NItJ,$r0J2<$N$h$&$KJQ99$7$F$_$^$7$?!#e(B

RESERVED = “|;/?:@&=+$,??[??]”

e$BFb3$Cme(B: ruby 1.8.6-p111 e$B$G$O<!$N$h$&$K$J$k!#e(B

RESERVED = “|;/?:@&=+$,\[\]”

e$B!Ve(B|e$B!W$rDI2C$7$F$$$^$9!#e(B
e$B$3$l$G<B9T$7$?$i$&$^$/F0$-$^$7$?!#e(B
//

e$B;d$N4D6-$G$b$3$l$G$&$^$/F0:n$7$F$$$^$9!#e(B

e$B%"%^%>%s$Ne(BWeb APIe$B$r;H$C$Fe(BORe$B8!:w$9$k>l9g$K$be(B
“|” e$B$r;H$&$=$&$G$9!#e(B

e$B$*<j?t$r$*3]$1$7$^$9$,=$@5$7$F$$$?$@$1$^$7$?$i9,$$$G$9!#e(B

e$B$3$s$K$A$O!#?y1:$H?=$7$^$9!#e(B

In Message “[ruby-dev:32168] Can’t use “|” in open-uri”
[email protected],
UTUMI Hirosi [email protected] said;
open-uri e$B$G;HMQ$9$kJ8;zNs$Ke(B “|” e$B$,4^$^$l$F$$$k$H!"e(B
bad URI e$B$HI=<($5$l$F=*N;$7$F$7$^$$$^$9!#e(B

e$B$&!<$s!#$*$=$i$/e(B bad URI e$B$G@5$7$$$s$8$c$J$$$G$7$g$&$+!#e(B

e$B;d$Oe(B Yahoo!e$B%G%Y%m%C%Q!<%M%C%H%o!<%/$Ne(B
e$B!VF|K\8l7ABVAG2r@Oe(BWebe$B%5!<%S%9!W$rMxMQ$7$F$$$k$N$G$9$,!“e(B
e$B$3$NCf$G$Oe(B URL e$B$Ke(B “|” e$B$r;HMQ$9$k%1!<%9$,$”$j$^$9!#e(B
http://developer.yahoo.co.jp/jlp/MAService/V1/parse.html

e$BNc$($P!V%F%9%H$G$9!W$H$$$&J8>O$r2r@O$7$Fe(B
e$BL>;l$H=uF0;l$r<h$j=P$9>l9g$O!"e(B
e$B<!$Ne(B URL e$B$r%j%/%(%9%H$9$k$3$H$K$J$j$^$9!#e(B
http://api.jlp.yahoo.co.jp/MAService/V1/parse?appid=YahooDemo&results=ma&filter
=9|12&sentence=e$B%F%9%H$G$9e(B
“filter=9|12” e$B$N$H$3$m$Ge(B “|” e$B$r;H$C$F$$$^$9!#e(B

e$B$3$l$O!"e(B

http://api.jlp.yahoo.co.jp/MAService/V1/parse?appid=YahooDemo&results=ma&filter=9|12&sentence=テストです

e$B$H!"%(%9%1!<%W$9$Y$-$@$H;W$$$^$9!#e(B
URI.escape e$B$r;H$&$H4JC1$K=PMh$^$9!#e(B

$ ruby -r uri -e ‘p
URI.escape("http://api.jlp.yahoo.co.jp/MAService/V1/parse?appid=YahooDemo&results=ma&filter=9|12&sentence=e$B%F%9%H$G$9e(B")
http://api.jlp.yahoo.co.jp/MAService/V1/parse?appid=YahooDemo&results=ma&filter=9|12&sentence=テストです

e$B$A$g$C$HD4$Y$F$_$^$7$?$,!"e(BURI e$B$NDj5A$r$7$F$$$ke(B RFC 3986
( http://www.ietf.org/rfc/rfc3986.txt ) e$B$K$h$l$P!"e(B

URI = scheme “:” hier-part [ “?” query ] [ “#” fragment ]
query = ( pchar / “/” / “?” )
pchar = unreserved / pct-encoded / sub-delims / “:” / “@”
unreserved = ALPHA / DIGIT / “-” / “.” / “_” / “~”
pct-encoded = “%” HEXDIG HEXDIG
reserved = gen-delims / sub-delims
gen-delims = “:” / “/” / “?” / “#” / “[” / “]” / “@”
sub-delims = “!” / “$” / “&” / “'” / “(” / “)”
/ "
" / “+” / “,” / “;” / “=”

e$B$H$J$C$F$$$k$N$G!"e(B “|” e$B$OF~$j$^$;$s!#e(B

e$B$^$?!"e(Buri/common.rb e$B$N%3%a%s%H$K$h$l$P!“e(BRESERVED
e$B$NItJ,$Oe(B RFC 2732
( http://www.ietf.org/rfc/rfc2732.txt ) e$B$r;2>H$7$F=q$+$l$?MM$G$9!#e(B
e$B$,!”$3$C$Ae(B(2732)e$B$K$be(B RFC 2396
(e$B8E$$e(BURIe$B$Ne(BRFC)e$B$N2~D{$H$7$F!"e(B

  unwise      = "{" | "}" | "|" | "\" | "^" | "`"

e$B$H$$$&Dj5A$,M-$j$^$9!#$G!"e(Bunwise e$B$H$$$&$N$Oe(B (RFC 2396
e$B$K$h$l$Pe(B)

Data corresponding to excluded characters must be escaped
in order to be properly represented within a URI.

e$B$H8@$&$3$H$J$N$G!“$d$O$j%(%9%1!<%W$9$kI,MW$,$”$k$h$&$G$9!#e(B

e$B;d$N4D6-$G$b$3$l$G$&$^$/F0:n$7$F$$$^$9!#e(B

e$B%"%^%>%s$Ne(BWeb APIe$B$r;H$C$Fe(BORe$B8!:w$9$k>l9g$K$be(B
“|” e$B$r;H$&$=$&$G$9!#e(B

e$B$*<j?t$r$*3]$1$7$^$9$,=$@5$7$F$$$?$@$1$^$7$?$i9,$$$G$9!#e(B

e$B;d$,e(B RFC
e$B$N99?7$r8+Mn$H$7$F$$$k2DG=@-$b$“$j$^$9$,!”$=$&$G$J$1$l$Pe(B
open-uri e$B$Ne(B e$B0z?t$Ke(B URI.escape
e$B$7$F$+$iEO$7$F$d$kJ}$,NI$$$+$H;W$$$^$9!#e(B

e$B%@%V%k%(%9%1!<%W$O5$$r$D$1$kI,MW$,$"$j$^$9$1$l$I!D!De(B

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

Tatsuki S. wrote:

e$B$H!"%(%9%1!<%W$9$Y$-$@$H;W$$$^$9!#e(B
URI.escape e$B$r;H$&$H4JC1$K=PMh$^$9!#e(B

e$BL5;v$Ke(B URI e$B$,EO$k$h$&$K$J$j$^$7$?!#e(B
e$B$"$j$,$H$&$4$6$$$^$9!#e(B
e$BF|K\8lItJ,$Oe(B CGI.escape e$B$7$F$$$?$N$G$9$,!"e(B
“|” e$B$NItJ,$K$D$$$F$O9M$($,5Z$S$^$;$s$G$7$?!#e(B
URI.escape e$B$H$$$&%a%=%C%I$bCN$i$J$+$C$?$N$G=u$+$j$^$7$?!#e(B

e$B$A$g$C$HD4$Y$F$_$^$7$?$,!"e(BURI e$B$NDj5A$r$7$F$$$ke(B RFC 3986
( http://www.ietf.org/rfc/rfc3986.txt ) e$B$K$h$l$P!"e(B
(snip)
e$B$H$J$C$F$$$k$N$G!"e(B “|” e$B$OF~$j$^$;$s!#e(B

Data corresponding to excluded characters must be escaped
in order to be properly represented within a URI.

e$B$H8@$&$3$H$J$N$G!“$d$O$j%(%9%1!<%W$9$kI,MW$,$”$k$h$&$G$9!#e(B

e$BN;2r$7$^$7$?!#e(B

e$BAa!9$KL@2w$J2sEz$r$$$?$@$1$F$H$F$b=u$+$j$^$7$?!#e(B
e$B$"$j$,$H$&$4$6$$$^$7$?!#e(B

e$B3+H/<T8~$1$Ne(B ML
e$B$K%a!<%k$r$*Aw$j$9$k$3$H$O$"$^$j$J$$$H;W$$$^$9$N$Ge(B
e$B$3$N5!2q$K$R$H$3$H?=$7E:$($^$9!#e(B
e$B;d$O%3!<%G%#%s%0$N$3$H$O$[$H$s$IJ,$+$i$J$$$N$G$9$,!"e(B
Ruby e$B$O3Z$7$/;H$($F$$$^$9!#e(B
irb e$B$Ge(B puts “test” e$B$HF~NO$7$Fe(B “test”
e$B$,I=<($5$l$?$H$-$O!“e(B
e$BEE5$20$NE9F,$Ge(B 10 print “test” e$B”*e(B Run
e$B$r<B9T$7$?$H$-$N$h$&$Je(B
e$B2{$+$7$5$r3P$($^$7$?!#e(B