url_encode
提供URL编码解码函数
仓库
okbob/url_encode
https://github.com/okbob/url_encode
源码
url_encode-1.2.5.tar.gz
url_encode-1.2.5.tar.gz
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
url_encode | 1.2.5 | UTIL | PostgreSQL | C |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 4190 | url_encode | 否 | 是 | 否 | 是 | 否 | 是 | - |
| 相关扩展 | pg_html5_email_address base36 base62 gzip bzip zstd http pg_net |
|---|
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.2.5 | 1817161514 | url_encode | - |
| RPM | PIGSTY | 1.2.5 | 1817161514 | url_encode_$v | - |
| DEB | PIGSTY | 1.2.5 | 1817161514 | postgresql-$v-url-encode | - |
构建
您可以使用 pig build 命令构建 url_encode 扩展的 RPM / DEB 包:
pig build pkg url_encode # 构建 RPM / DEB 包
安装
您可以直接安装 url_encode 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
pig repo add pgsql -u # 添加仓库并更新缓存
使用 pig 或者是 apt/yum/dnf 安装扩展:
pig install url_encode; # 当前活跃 PG 版本安装
pig ext install -y url_encode -v 18 # PG 18
pig ext install -y url_encode -v 17 # PG 17
pig ext install -y url_encode -v 16 # PG 16
pig ext install -y url_encode -v 15 # PG 15
pig ext install -y url_encode -v 14 # PG 14
dnf install -y url_encode_18 # PG 18
dnf install -y url_encode_17 # PG 17
dnf install -y url_encode_16 # PG 16
dnf install -y url_encode_15 # PG 15
dnf install -y url_encode_14 # PG 14
apt install -y postgresql-18-url-encode # PG 18
apt install -y postgresql-17-url-encode # PG 17
apt install -y postgresql-16-url-encode # PG 16
apt install -y postgresql-15-url-encode # PG 15
apt install -y postgresql-14-url-encode # PG 14
创建扩展:
CREATE EXTENSION url_encode;
用法
函数
url_encode(text) returns text
对字符串进行百分号编码,用于 URL 中:
SELECT url_encode('Hello World');
-- Hello%20World
SELECT url_encode('Ahoj Svetе');
-- Ahoj%20Sv%C4%9Bte
url_decode(text) returns text
解码百分号编码的字符串:
SELECT url_decode('Hello%20World');
-- Hello World
SELECT url_decode('Ahoj%20Sv%C4%9Bte');
-- Ahoj Svetе
uri_encode(text) returns text
编码完整的 URI(保留协议、斜杠等):
SELECT uri_encode('http://hu.wikipedia.org/wiki/Sao_Paulo');
-- http://hu.wikipedia.org/wiki/S%C3%A3o_Paulo
uri_decode(text) returns text
解码已编码的 URI:
SELECT uri_decode('http://hu.wikipedia.org/wiki/S%C3%A3o_Paulo');
-- http://hu.wikipedia.org/wiki/Sao_Paulo