description:How to use Ruby's standard library to decode URLs with a handy one-liner.
categories:
-blogumentation
tags:
-blogumentation
-ruby
-cli
date:2019-05-31T21:58:11+0100
license_prose:CC-BY-NC-SA-4.0
license_code:Apache-2.0
slug:url-decode-ruby-cli
---
When working with URLs that contain other URLs (such as a `redirect_uri` in an OAuth2 authorization request), you may get annoyed when you can't decode the encoded URL, **??**.
Following the advice from [this Stack Overflow answer](https://stackoverflow.com/a/7146153/2257038), we can use `CGI.unescape`, and create a nice command-line one-liner: