小编Rok*_*oki的帖子

Javascript encodeURI喜欢postgresql中的函数吗?

PostgreSQL/plpgsql中有没有与javascripts encodeURI相同的函数/存储过程?

这是什么意思?Javascript有一个方便的内置函数来编码任何类型的URL:

encodeURI(url) - >返回已编码的url

例如: encodeURI('http://hu.wikipedia.org/wiki/São_Paulo')- >返回一个String"http://hu.wikipedia.org/wiki/S%C3%A3o_Paulo"

我寻找完全一样的.

我不想单独编码每个参数.我不希望像javascript encodeURIComponent这样的函数不一样.上面的例子产生了不同的输出

encodeURIComponent('http://hu.wikipedia.org/wiki/São_Paulo')
Run Code Online (Sandbox Code Playgroud)

- > "http%3A%2F%2Fhu.wikipedia.org%2Fwiki%2FS%C3%A3o_Paulo"

它编码整个字符串而不仅仅是路径部分.所以这不是我想要的.我需要一个plpgsql函数,它导致javascript函数encodeURI的等效输出.

谢谢!

postgresql stored-procedures urlencode plpgsql

5
推荐指数
5
解决办法
5846
查看次数