aboutsummaryrefslogtreecommitdiff
path: root/libsylph/utils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-03-17 04:48:28 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-03-17 04:48:28 +0000
commit5d5b413e4b4213e72f51d6393d4f42ba96936ea2 (patch)
tree470154d84b34f340f90ceefb0ccbc936869002a7 /libsylph/utils.c
parent0758434f9b288d0c05d7df2147a24c0ca9af0492 (diff)
implemented RFC 2231 filename encoding on send.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1052 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r--libsylph/utils.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index a2c3bd3e..914fd007 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -1629,8 +1629,8 @@ void decode_uri(gchar *decoded_uri, const gchar *encoded_uri)
while (*enc) {
if (*enc == '%') {
enc++;
- if (isxdigit((guchar)enc[0]) &&
- isxdigit((guchar)enc[1])) {
+ if (g_ascii_isxdigit((guchar)enc[0]) &&
+ g_ascii_isxdigit((guchar)enc[1])) {
*dec = axtoi(enc);
dec++;
enc += 2;
@@ -1648,6 +1648,26 @@ void decode_uri(gchar *decoded_uri, const gchar *encoded_uri)
*dec = '\0';
}
+void decode_xdigit_encoded_str(gchar *decoded, const gchar *encoded)
+{
+ gchar *dec = decoded;
+ const gchar *enc = encoded;
+
+ while (*enc) {
+ if (*enc == '%') {
+ enc++;
+ if (g_ascii_isxdigit((guchar)enc[0]) &&
+ g_ascii_isxdigit((guchar)enc[1])) {
+ *dec++ = axtoi(enc);
+ enc += 2;
+ }
+ } else
+ *dec++ = *enc++;
+ }
+
+ *dec = '\0';
+}
+
gchar *encode_uri(const gchar *filename)
{
gchar *uri;