ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux上怎么直接使用urlencode、urldecode命令

Linux上怎么直接使用urlencode、urldecode命令

原创 Linux操作系统 作者:TOmDD 时间:2020-04-29 11:25:27 0 删除 编辑

运维人员,经常在linux操作系统上干活,有时候需要对url做encode或者decode操作。 一般linux操作系统都没有直接支持这个命令的。如果想用,需要安装一个软件包。


CentOS安装:

yum install gridsite-clients


然后直接使用:

[root@local ~]# urlencode 'https:///'
https%3A%2F%2F%2F


关于命令的详细使用方法:

NAME
       urlencode - convert strings to or from URL-encoded form
SYNOPSIS
       urlencode [-m|-d] string [string ...]
DESCRIPTION
       urlencode encodes strings according to RFC 1738.
       That is, characters A-Z a-z 0-9 . _ and - are passed through unmodified, but all other characters are represented as %HH, where HH is
       their  two-digit  upper-case  hexadecimal  ASCII   representation.    For   example,   the   URL   http:///   becomes
       http%3A%2F%2F%2F
       urlencode  converts each character in all the strings given on the command line. If multiple strings are given, they are concatenated
       with separating spaces before conversion.
OPTIONS
       -m     Instead of full conversion, do GridSite "mild URL encoding" in which A-Z a-z 0-9 . = - _ @ and / are  passed  through  unmodi‐
              fied.  This  results  in  slightly  more human-readable strings but the application must be prepared to create or simulate the
              directories implied by any slashes.
       -d     Do URL-decoding rather than encoding, according to RFC 1738. %HH and %hh strings are converted and other characters are passed
              through unmodified, with the exception that + is converted to space.


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69965015/viewspace-2689164/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-03-01

  • 博文量
    14
  • 访问量
    45490