uri/common.rb: Update URI::WEB_ENCODINGS_ [ci skip]

* lib/uri/common.rb (WEB_ENCODINGS_): split command lines and
  append a trailing comma.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-10-06 02:04:28 +00:00
parent 48f9118253
commit a566bc0a38
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,7 @@
Thu Oct 6 11:01:49 2016 Tieg Zaharia <tieg.zaharia@gmail.com>
* lib/uri/common.rb (WEB_ENCODINGS_): Update URI::WEB_ENCODINGS_
hash, and fix documented command to grab it. [Fix GH-1430]
Thu Oct 6 10:37:13 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>

View File

@ -487,7 +487,24 @@ module URI
end
private
# curl https://encoding.spec.whatwg.org/encodings.json|ruby -rpp -rjson -e'H={};h={"shift_jis"=>"Windows-31J","euc-jp"=>"cp51932","iso-2022-jp"=>"cp50221","x-mac-cyrillic"=>"macCyrillic"};JSON($<.read).map{|x|x["encodings"]}.flatten.each{|x|Encoding.find(n=h.fetch(n=x["name"].downcase,n))rescue next;x["labels"].each{|y|H[y]=n}};pp H'
=begin command for WEB_ENCODINGS_
curl https://encoding.spec.whatwg.org/encodings.json|
ruby -rjson -e 'H={}
h={
"shift_jis"=>"Windows-31J",
"euc-jp"=>"cp51932",
"iso-2022-jp"=>"cp50221",
"x-mac-cyrillic"=>"macCyrillic",
}
JSON($<.read).map{|x|x["encodings"]}.flatten.each{|x|
Encoding.find(n=h.fetch(n=x["name"].downcase,n))rescue next
x["labels"].each{|y|H[y]=n}
}
puts "{"
H.each{|k,v|puts %[ #{k.dump}=>#{v.dump},]}
puts "}"
'
=end
WEB_ENCODINGS_ = {
"unicode-1-1-utf-8"=>"utf-8",
"utf-8"=>"utf-8",
@ -693,7 +710,7 @@ module URI
"windows-949"=>"euc-kr",
"utf-16be"=>"utf-16be",
"utf-16"=>"utf-16le",
"utf-16le"=>"utf-16le"
"utf-16le"=>"utf-16le",
} # :nodoc:
# :nodoc: