20
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

URLエンコード/デコード

Last updated at Posted at 2012-08-08

rubyメモ

require 'uri'

url = 'http://hogehoge.com/hogahoga.cgi?test=日本語テスト'
url_escape = URI.escape(url)

puts url_escape
  #=> http://hogehoge.com/hogahoga.cgi?test=%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%83%86%e3%82%b9%e3%83%88


puts URI.unescape(url_escape)
  #=>http://hogehoge.com/hogahoga.cgi?test=日本語テスト

20
20
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?