システムのロケールで設定されているエンコーディング名は Encoding.locale_charmap で取得できる。
"文字列".encode(Encoding.locale_charmap)
"文字列".encode(Encoding.locale_charmap)
require 'open-uri'
open("http://example.com/hoge.html", "Referer" => "http://example.com/") {|file|
puts file.read()
}
open("https://example.com/", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE) {|file|
puts file.read()
}
Could not open database at file://localhost/Users/名前/Library/Application%20Support/iPhone%20Simulator/5.1/Media/iTunes_Control/iTunes/MediaLibrary.sqlitedb?readonly_shm=1: unable to open database fileと表示される。シミュレータにはiPodのライブラリが入っていないので当然であるが、ライブラリ構築済みのiPhoneからシミュレータにライブラリのデータベースファイルをコピーすることで、シミュレータでも MPMediaQuery のクエリをテストできるようにする。