ed8562a56064489a6514fa1fd1aee3e1c32caafa
2 * Copyright (C) 2013 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public
17 * License along with this program. If not, see
18 * <http://www.gnu.org/licenses/>.
27 static gboolean
_is_unescaped(const gchar
*s
)
31 u
= g_uri_unescape_string(s
, NULL
);
32 r
= g_strcmp0(u
,s
) == 0 ? TRUE
:FALSE
;
37 gchar
*m_url_unescaped_form(const gchar
*s
)
39 gchar
*r
= g_strdup(s
);
42 gchar
*u
= g_uri_unescape_string(r
, NULL
);
46 while (_is_unescaped(r
) == FALSE
);
50 gchar
*m_url_escaped_form(const gchar
*s
)
52 static const gchar
*reserved_chars
= "!*'();:@&=+$,/?#[]";
54 u
= m_url_unescaped_form(s
);
55 r
= g_uri_escape_string(u
, reserved_chars
, FALSE
);
60 /* vim: set ts=2 sw=2 tw=72 expandtab: */