From 3463dc142b787d8010cf9310caa7915f30a9e275 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 18 Jul 2013 20:58:04 -0600 Subject: * Extended support for recognition of UTF-8 in urls, according to information from http://url.spec.whatwg.org --- pith/pine.hlp | 4 +++- pith/url.c | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) (limited to 'pith') diff --git a/pith/pine.hlp b/pith/pine.hlp index cf5039b1..7f7a1334 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 17 2013-07-15 14:35:02 +Alpine Commit 18 2013-07-18 20:57:53 ============= h_news ================= @@ -184,6 +184,8 @@ Additions include: with a quote string, followed by a space were considered individual paragraphs, now they are considered part of a paragraph. Based on earlier joint work with Jeff Franklin. +
  • Extended support of recognition of UTF-8 in urls based on information from +http://url.spec.whatwg.org.
  • Add ability to color folder names, directory names, and text in the FOLDER SCREEN. diff --git a/pith/url.c b/pith/url.c index 173cb879..1798320d 100644 --- a/pith/url.c +++ b/pith/url.c @@ -248,11 +248,48 @@ rfc1738_str(char *s) int rfc1738uchar(char *s) { - return((RFC1738_ESC(s)) /* "escape" */ + int valid = (RFC1738_ESC(s)) /* "escape" */ ? 2 : (isalnum((unsigned char) *s) /* alphanumeric */ || strchr(RFC1738_SAFE, *s) /* other special stuff */ - || strchr(RFC1738_EXTRA, *s))); + || strchr(RFC1738_EXTRA, *s)); + + if(!valid){ + char *t; + UCS ucs; + CBUF_S cbuf; + + cbuf.cbuf[0] = '\0'; + cbuf.cbufp = cbuf.cbuf; + cbuf.cbufend = cbuf.cbuf; + + for(t = s; t && *t; t++){ + if(utf8_to_ucs4_oneatatime((unsigned char) *t & 0xff, &cbuf, &ucs, NULL)){ + if ((ucs >= 0x00A0 && ucs <= 0xD7FF) + || (ucs >= 0xE000 && ucs <= 0xFDCF) + || (ucs >= 0xFDF0 && ucs <= 0xFFEF) + || (ucs >= 0x10000 && ucs <= 0x1FFFD) + || (ucs >= 0x20000 && ucs <= 0x2FFFD) + || (ucs >= 0x30000 && ucs <= 0x3FFFD) + || (ucs >= 0x40000 && ucs <= 0x4FFFD) + || (ucs >= 0x50000 && ucs <= 0x5FFFD) + || (ucs >= 0x60000 && ucs <= 0x6FFFD) + || (ucs >= 0x70000 && ucs <= 0x7FFFD) + || (ucs >= 0x80000 && ucs <= 0x8FFFD) + || (ucs >= 0x90000 && ucs <= 0x9FFFD) + || (ucs >= 0xA0000 && ucs <= 0xAFFFD) + || (ucs >= 0xB0000 && ucs <= 0xBFFFD) + || (ucs >= 0xC0000 && ucs <= 0xCFFFD) + || (ucs >= 0xD0000 && ucs <= 0xDFFFD) + || (ucs >= 0xE0000 && ucs <= 0xEFFFD) + || (ucs >= 0xF0000 && ucs <= 0xFFFFD) + || (ucs >= 0x100000 && ucs <= 0x10FFFD)) + valid = t-s+1; + break; + } + } + } + return valid; } -- cgit v1.2.3-70-g09d2