petere / pguri

uri type for PostgreSQL

Home Page:https://twitter.com/pvh/status/567395527357001728

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid input syntax when inserting urls with accents

natoinet opened this issue · comments

Hello,

When inserting urls with accents, I run into the following error:

insert into urljson values ('http://www.example.com/évidemment', 200, 'text/html; charset=UTF-8', 33055);
ERROR:  invalid input syntax for type uri at or near "évidemment"
LINE 1: insert into urljson values ('http://www.example.com/évidemme...
                                                     ^

I know that urls should not contain accents ... But they actually do! Is it caused by some kind of encoding problems?

Thanks!

Punycode is not supported. Maybe it should.

In the mean time there is an other extension that can solve your problem.

https://github.com/okbob/url_encode

insert into urljson values
  (
    url_encode('http://www.example.com/évidemment'),
    200,
    'text/html; charset=UTF-8', 33055
  );