Commit a32bf68c authored by Tatsuya Kinoshita's avatar Tatsuya Kinoshita

Support the siteconf feature

Patch to support the siteconf feature, from [w3m-dev 04463]
on 2012-06-27, provided by AIDA Shinra.
parent dbd52ac2
......@@ -200,10 +200,11 @@ _put_anchor_news(Buffer *buf, char *p1, char *p2, int line, int pos)
if (*(p2 - 1) == '>')
p2--;
}
tmp = wc_Str_conv_strict(Strnew_charp_n(p1, p2 - p1), InnerCharset,
buf->document_charset);
tmp = Sprintf("news:%s", file_quote(tmp->ptr));
return registerHref(buf, tmp->ptr, NULL, NO_REFERER, NULL, '\0', line,
tmp = Strnew_charp("news:");
Strcat_charp_n(tmp, p1, p2 - p1);
return registerHref(buf, url_encode(tmp->ptr, baseURL(buf),
buf->document_charset),
NULL, NO_REFERER, NULL, '\0', line,
pos);
}
#endif /* USE_NNTP */
......@@ -213,9 +214,10 @@ _put_anchor_all(Buffer *buf, char *p1, char *p2, int line, int pos)
{
Str tmp;
tmp = wc_Str_conv_strict(Strnew_charp_n(p1, p2 - p1), InnerCharset,
buf->document_charset);
return registerHref(buf, url_quote(tmp->ptr), NULL, NO_REFERER, NULL,
tmp = Strnew_charp_n(p1, p2 - p1);
return registerHref(buf, url_encode(tmp->ptr, baseURL(buf),
buf->document_charset),
NULL, NO_REFERER, NULL,
'\0', line, pos);
}
......@@ -756,7 +758,7 @@ link_list_panel(Buffer *buf)
p = parsedURL2Str(&pu)->ptr;
u = html_quote(p);
if (DecodeURL)
p = html_quote(url_unquote_conv(p, buf->document_charset));
p = html_quote(url_decode2(p, buf));
else
p = u;
}
......@@ -787,7 +789,7 @@ link_list_panel(Buffer *buf)
p = parsedURL2Str(&pu)->ptr;
u = html_quote(p);
if (DecodeURL)
p = html_quote(url_unquote_conv(p, buf->document_charset));
p = html_quote(url_decode2(p, buf));
else
p = u;
t = getAnchorText(buf, al, a);
......@@ -809,16 +811,13 @@ link_list_panel(Buffer *buf)
p = parsedURL2Str(&pu)->ptr;
u = html_quote(p);
if (DecodeURL)
p = html_quote(url_unquote_conv(p, buf->document_charset));
p = html_quote(url_decode2(p, buf));
else
p = u;
if (a->title && *a->title)
t = html_quote(a->title);
else if (DecodeURL)
t = html_quote(url_unquote_conv
(a->url, buf->document_charset));
else
t = html_quote(a->url);
t = html_quote(url_decode2(a->url, buf));
Strcat_m_charp(tmp, "<li><a href=\"", u, "\">", t, "</a><br>", p,
"\n", NULL);
a = retrieveAnchor(buf->formitem, a->start.line, a->start.pos);
......@@ -842,19 +841,13 @@ link_list_panel(Buffer *buf)
p = parsedURL2Str(&pu)->ptr;
u = html_quote(p);
if (DecodeURL)
p = html_quote(url_unquote_conv(p,
buf->
document_charset));
p = html_quote(url_decode2(p, buf));
else
p = u;
if (m->alt && *m->alt)
t = html_quote(m->alt);
else if (DecodeURL)
t = html_quote(url_unquote_conv(m->url,
buf->
document_charset));
else
t = html_quote(m->url);
t = html_quote(url_decode2(m->url, buf));
Strcat_m_charp(tmp, "<li><a href=\"", u, "\">", t,
"</a><br>", p, "\n", NULL);
}
......
......@@ -25,6 +25,7 @@
#define PASSWD_FILE RC_DIR "/passwd"
#define PRE_FORM_FILE RC_DIR "/pre_form"
#define SITECONF_FILE RC_DIR "/siteconf"
#define USER_MAILCAP RC_DIR "/mailcap"
#define SYS_MAILCAP CONF_DIR "/mailcap"
#define USER_MIMETYPES "~/.mime.types"
......
......@@ -257,7 +257,7 @@ make_lastline_link(Buffer *buf, char *title, char *url)
parseURL2(url, &pu, baseURL(buf));
u = parsedURL2Str(&pu);
if (DecodeURL)
u = Strnew_charp(url_unquote_conv(u->ptr, buf->document_charset));
u = Strnew_charp(url_decode2(u->ptr, buf));
#ifdef USE_M17N
u = checkType(u, &pr, NULL);
#endif
......
siteconf: サイト別カスタマイズ
siteconf は、 URL のパターンと、それに紐付けられた設定から成ります。
siteconf を使うと、サイト毎に文字コードを指定して "decode_url"
の出力を改善したり、 Google のリダイレクタを迂回して性能や
プライバシーを向上させたりすることができます。
デフォルトでは siteconf は ~/.w3m/siteconf から読み込まれます。
===== 構文 =====
url <url>|/<re-url>/|m@<re-url>@i [exact]
substitute_url "<destination-url>"
url_charset <charset>
no_referer_from on|off
no_referer_to on|off
後ろの方に書かれたものが優先されます。
===== 例 =====
url "http://twitter.com/#!/"
substitute_url "http://mobile.twitter.com/"
twitter.com をモバイルサイトに転送します。
url "http://your.bookmark.net/"
no_referer_from on
your.bookmark.net から張ったリンクを辿る際に、 HTTP referer を
送らないようにします。
url "http://www.google.com/url?" exact
substitute_url "file:///cgi-bin/your-redirector.cgi?"
Google のリダイレクタを local CGI に転送します。
url /^http:\/\/[a-z]*\.wikipedia\.org\//
url_charset utf-8
同時に "decode_url" オプションをオンにすると、 Wikipedia への
リンクを UTF-8 としてデコードして表示します。
===== 正規表現について =====
次の正規表現はいずれも同じ意味を表します。
/http:\/\/www\.example\.com\//
m/http:\/\/www\.example\.com\//
m@http://www\.example\.com/@
m!http://www\.example\.com/!
最後に 'i' 修飾子を付けると、大文字小文字を区別せずに照合を行います。
例えば、 m@^http://www\.example\.com/abc/@i は以下のいずれとも一致します。
http://www.example.com/abc/
http://www.example.com/Abc/
http://www.example.com/ABC/
ただし、ホスト名の部分は常に小文字に変換してから比較します。
The siteconf: Site-specific preferences
The siteconf consists of URL patterns and preferences associated to them.
You can improve "decode_url" feature by giving charsets of URLs site by site,
or bypass Google's redirector for performance and your privacy.
The siteconf is read from ~/.w3m/siteconf by default.
===== The syntax =====
url <url>|/<re-url>/|m@<re-url>@i [exact]
substitute_url "<destination-url>"
url_charset <charset>
no_referer_from on|off
no_referer_to on|off
The last match wins.
===== Examples =====
url "http://twitter.com/#!/"
substitute_url "http://mobile.twitter.com/"
This forwards the twitter.com to its mobile site.
url "http://your.bookmark.net/"
no_referer_from on
This prevents HTTP referers from being sent when you follow links
at the your.bookmark.net.
url "http://www.google.com/url?" exact
substitute_url "file:///cgi-bin/your-redirector.cgi?"
This forwards the Google's redirector to your local CGI.
url /^http:\/\/[a-z]*\.wikipedia\.org\//
url_charset utf-8
When combinated with "decode_url" option turned on, links to
Wikipedia will be human-readable.
===== Regular expressions notes =====
Following expressions are all equivalent:
/http:\/\/www\.example\.com\//
m/http:\/\/www\.example\.com\//
m@http://www\.example\.com/@
m!http://www\.example\.com/!
With a trailing 'i' modifier, you can specify a case-insensitive match.
For example, m@^http://www\.example\.com/abc/@i matches to:
http://www.example.com/abc/
http://www.example.com/Abc/
http://www.example.com/ABC/
Hostnames, however, are always converted to lowercases before compared.
This diff is collapsed.
......@@ -264,6 +264,18 @@ extern int REV_LB[];
#define IMG_FLAG_ERROR 2
#define IMG_FLAG_DONT_REMOVE 4
#define IS_EMPTY_PARSED_URL(pu) ((pu)->scheme == SCM_UNKNOWN && !(pu)->file)
#define SCONF_RESERVED 0
#define SCONF_SUBSTITUTE_URL 1
#define SCONF_URL_CHARSET 2
#define SCONF_NO_REFERER_FROM 3
#define SCONF_NO_REFERER_TO 4
#define SCONF_N_FIELD 5
#define query_SCONF_SUBSTITUTE_URL(pu) ((const char *)querySiteconf(pu, SCONF_SUBSTITUTE_URL))
#define query_SCONF_URL_CHARSET(pu) ((const wc_ces *)querySiteconf(pu, SCONF_URL_CHARSET))
#define query_SCONF_NO_REFERER_FROM(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_FROM))
#define query_SCONF_NO_REFERER_TO(pu) ((const int *)querySiteconf(pu, SCONF_NO_REFERER_TO))
/*
* Macros.
*/
......@@ -972,6 +984,7 @@ global int BackgroundExtViewer init(TRUE);
global int disable_secret_security_check init(FALSE);
global char *passwd_file init(PASSWD_FILE);
global char *pre_form_file init(PRE_FORM_FILE);
global char *siteconf_file init(SITECONF_FILE);
global char *ftppasswd init(NULL);
global int ftppass_hostnamegen init(TRUE);
global int do_download init(FALSE);
......
......@@ -787,7 +787,7 @@ struct pre_form {
static struct pre_form *PreForm = NULL;
static struct pre_form *
add_pre_form(struct pre_form *prev, char *url, char *name, char *action)
add_pre_form(struct pre_form *prev, char *url, Regex *re_url, char *name, char *action)
{
ParsedURL pu;
struct pre_form *new;
......@@ -796,21 +796,13 @@ add_pre_form(struct pre_form *prev, char *url, char *name, char *action)
new = prev->next = New(struct pre_form);
else
new = PreForm = New(struct pre_form);
if (url && *url == '/') {
int l = strlen(url);
if (l > 1 && url[l - 1] == '/')
new->url = allocStr(url + 1, l - 2);
else
new->url = url + 1;
new->re_url = newRegex(new->url, FALSE, NULL, NULL);
if (!new->re_url)
new->url = NULL;
}
else if (url) {
if (url && !re_url) {
parseURL2(url, &pu, NULL);
new->url = parsedURL2Str(&pu)->ptr;
new->re_url = NULL;
}
else
new->url = url;
new->re_url = re_url;
new->name = (name && *name) ? name : NULL;
new->action = (action && *action) ? action : NULL;
new->item = NULL;
......@@ -834,7 +826,7 @@ add_pre_form_item(struct pre_form *pf, struct pre_form_item *prev, int type,
new->name = name;
new->value = value;
if (checked && *checked && (!strcmp(checked, "0") ||
strcasecmp(checked, "off")
!strcasecmp(checked, "off")
|| !strcasecmp(checked, "no")))
new->checked = 0;
else
......@@ -875,6 +867,7 @@ loadPreForm(void)
return;
while (1) {
char *p, *s, *arg;
Regex *re_arg;
line = Strfgets(fp);
if (line->length == 0)
......@@ -890,18 +883,20 @@ loadPreForm(void)
if (*p == '#' || *p == '\0')
continue; /* comment or empty line */
s = getWord(&p);
arg = getWord(&p);
if (!strcmp(s, "url")) {
arg = getRegexWord((const char **)&p, &re_arg);
if (!arg || !*arg)
continue;
p = getQWord(&p);
pf = add_pre_form(pf, arg, NULL, p);
pf = add_pre_form(pf, arg, re_arg, NULL, p);
pi = pf->item;
continue;
}
if (!pf)
continue;
arg = getWord(&p);
if (!strcmp(s, "form")) {
if (!arg || !*arg)
continue;
......@@ -913,7 +908,7 @@ loadPreForm(void)
}
if (pf->item) {
struct pre_form *prev = pf;
pf = add_pre_form(prev, "", s, p);
pf = add_pre_form(prev, "", NULL, s, p);
/* copy previous URL */
pf->url = prev->url;
pf->re_url = prev->re_url;
......
......@@ -91,7 +91,8 @@ newFrame(struct parsed_tag *tag, Buffer *buf)
body->baseURL = baseURL(buf);
if (tag) {
if (parsedtag_get_value(tag, ATTR_SRC, &p))
body->url = url_quote_conv(remove_space(p), buf->document_charset);
body->url = url_encode(remove_space(p), body->baseURL,
buf->document_charset);
if (parsedtag_get_value(tag, ATTR_NAME, &p) && *p != '_')
body->name = url_quote_conv(p, buf->document_charset);
}
......@@ -639,7 +640,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level,
case HTML_BASE:
/* "BASE" is prohibit tag */
if (parsedtag_get_value(tag, ATTR_HREF, &q)) {
q = url_quote_conv(remove_space(q), charset);
q = url_encode(remove_space(q), NULL, charset);
parseURL(q, &base, NULL);
}
if (parsedtag_get_value(tag, ATTR_TARGET, &q)) {
......@@ -768,8 +769,8 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level,
if (!tag->value[j])
break;
tag->value[j] =
url_quote_conv(remove_space(tag->value[j]),
charset);
url_encode(remove_space(tag->value[j]),
&base, charset);
tag->need_reconstruct = TRUE;
parseURL2(tag->value[j], &url, &base);
if (url.scheme == SCM_UNKNOWN ||
......
......@@ -8,6 +8,7 @@
#include "fm.h"
#include "func.h"
#include "myctype.h"
#include "regex.h"
#include "funcname.c"
#include "functable.c"
......@@ -434,6 +435,93 @@ getQWord(char **str)
return tmp->ptr;
}
/* This extracts /regex/i or m@regex@i from the given string.
* Then advances *str to the end of regex.
* If the input does not seems to be a regex, this falls back to getQWord().
*
* Returns a word (no matter whether regex or not) in the give string.
* If regex_ret is non-NULL, compiles the regex and stores there.
*
* XXX: Actually this is unrelated to func.c.
*/
char *
getRegexWord(const char **str, Regex **regex_ret)
{
char *word = NULL;
const char *p, *headp, *bodyp, *tailp;
char delimiter;
int esc;
int igncase = 0;
p = *str;
SKIP_BLANKS(p);
headp = p;
/* Get the opening delimiter */
if (p[0] == 'm' && IS_PRINT(p[1]) && !IS_ALNUM(p[1]) && p[1] != '\\') {
delimiter = p[1];
p += 2;
}
else if (p[0] == '/') {
delimiter = '/';
p += 1;
}
else {
goto not_regex;
}
bodyp = p;
/* Scan the end of the expression */
for (esc = 0; *p; ++p) {
if (esc) {
esc = 0;
} else {
if (*p == delimiter)
break;
else if (*p == '\\')
esc = 1;
}
}
if (!*p && *headp == '/')
goto not_regex;
tailp = p;
/* Check the modifiers */
if (*p == delimiter) {
while (*++p && !IS_SPACE(*p)) {
switch (*p) {
case 'i':
igncase = 1;
break;
}
/* ignore unknown modifiers */
}
}
/* Save the expression */
word = allocStr(headp, p - headp);
/* Compile */
if (regex_ret) {
if (*tailp == delimiter)
word[tailp - headp] = 0;
*regex_ret = newRegex(word + (bodyp - headp), igncase, NULL, NULL);
if (*tailp == delimiter)
word[tailp - headp] = delimiter;
}
goto last;
not_regex:
p = headp;
word = getQWord((char **)&p);
if (regex_ret)
*regex_ret = NULL;
last:
*str = p;
return word;
}
#ifdef USE_MOUSE
static MouseAction default_mouse_action = {
NULL,
......
......@@ -17,7 +17,7 @@ historyBuffer(Hist *hist)
for (item = hist->list->last; item; item = item->prev) {
q = html_quote((char *)item->ptr);
if (DecodeURL)
p = html_quote(url_unquote_conv((char *)item->ptr, 0));
p = html_quote(url_decode2((char *)item->ptr, NULL));
else
p = q;
Strcat_charp(src, "<li><a href=\"");
......
......@@ -357,6 +357,20 @@ strcasemstr(char *str, char *srch[], char **ret_ptr)
return -1;
}
int
strmatchlen(const char *s1, const char *s2, int maxlen)
{
int i;
/* To allow the maxlen to be negatie (infinity),
* compare by "!=" instead of "<=". */
for (i = 0; i != maxlen; ++i) {
if (!s1[i] || !s2[i] || s1[i] != s2[i])
break;
}
return i;
}
char *
remove_space(char *str)
{
......
......@@ -52,6 +52,7 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n);
extern char *strcasestr(const char *s1, const char *s2);
#endif
extern int strcasemstr(char *str, char *srch[], char **ret_ptr);
int strmatchlen(const char *s1, const char *s2, int maxlen);
extern char *remove_space(char *str);
extern int non_null(char *s);
extern void cleanup_line(Str s, int mode);
......
......@@ -1026,7 +1026,7 @@ _prev(void)
strCurrentBuf = strBuf;
}
if (DecodeURL && (cm_mode & CPL_URL) )
p = url_unquote_conv(p, 0);
p = url_decode2(p, NULL);
strBuf = Strnew_charp(p);
CLen = CPos = setStrType(strBuf, strProp);
offset = 0;
......@@ -1045,7 +1045,7 @@ _next(void)
p = nextHist(hist);
if (p) {
if (DecodeURL && (cm_mode & CPL_URL) )
p = url_unquote_conv(p, 0);
p = url_decode2(p, NULL);
strBuf = Strnew_charp(p);
}
else {
......
......@@ -894,12 +894,17 @@ main(int argc, char **argv, char **envp)
if (i >= 0) {
SearchHeader = search_header;
DefaultType = default_type;
char *url;
url = load_argv[i];
if (getURLScheme(&url) == SCM_MISSING && !ArgvIsURL)
url = file_to_url(load_argv[i]);
else
url = url_encode(conv_from_system(load_argv[i]), NULL, 0);
if (w3m_dump == DUMP_HEAD) {
request = New(FormList);
request->method = FORM_METHOD_HEAD;
newbuf =
loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0,
request);
newbuf = loadGeneralFile(url, NULL, NO_REFERER, 0, request);
}
else {
if (post_file && i == 0) {
......@@ -928,9 +933,7 @@ main(int argc, char **argv, char **envp)
else {
request = NULL;
}
newbuf =
loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0,
request);
newbuf = loadGeneralFile(url, NULL, NO_REFERER, 0, request);
}
if (newbuf == NULL) {
/* FIXME: gettextize? */
......@@ -945,7 +948,7 @@ main(int argc, char **argv, char **envp)
break;
case SCM_LOCAL:
case SCM_LOCAL_CGI:
unshiftHist(LoadHist, conv_from_system(load_argv[i]));
unshiftHist(LoadHist, url);
default:
pushHashHist(URLHist, parsedURL2Str(&newbuf->currentURL)->ptr);
break;
......@@ -1269,15 +1272,12 @@ do_dump(Buffer *buf)
printf("\nReferences:\n\n");
for (i = 0; i < buf->href->nanchor; i++) {
ParsedURL pu;
static Str s = NULL;
char *url;
if (buf->href->anchors[i].slave)
continue;
parseURL2(buf->href->anchors[i].url, &pu, baseURL(buf));
s = parsedURL2Str(&pu);
if (DecodeURL)
s = Strnew_charp(url_unquote_conv
(s->ptr, Currentbuf->document_charset));
printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, s->ptr);
url = url_decode2(parsedURL2Str(&pu)->ptr, Currentbuf);
printf("[%d] %s\n", buf->href->anchors[i].hseq + 1, url);
}
}
}
......@@ -2261,7 +2261,7 @@ DEFUN(movR1, MOVE_RIGHT1,
static wc_uint32
getChar(char *p)
{
return wc_any_to_ucs(wtf_parse1(&p));
return wc_any_to_ucs(wtf_parse1((wc_uchar **)&p));
}
static int
......@@ -2804,12 +2804,15 @@ loadLink(char *url, char *target, char *referer, FormList *request)
union frameset_element *f_element = NULL;
int flag = 0;
ParsedURL *base, pu;
const int *no_referer_ptr;
message(Sprintf("loading %s", url)->ptr, 0, 0);
refresh();
no_referer_ptr = query_SCONF_NO_REFERER_FROM(&Currentbuf->currentURL);
base = baseURL(Currentbuf);
if (base == NULL ||
if ((no_referer_ptr && *no_referer_ptr) ||
base == NULL ||
base->scheme == SCM_LOCAL || base->scheme == SCM_LOCAL_CGI)
referer = NO_REFERER;
if (referer == NULL)
......@@ -4055,6 +4058,7 @@ goURL0(char *prompt, int relative)
char *url, *referer;
ParsedURL p_url, *current;
Buffer *cur_buf = Currentbuf;
const int *no_referer_ptr;
url = searchKeyData();
if (url == NULL) {
......@@ -4064,11 +4068,8 @@ goURL0(char *prompt, int relative)
current = baseURL(Currentbuf);
if (current) {
char *c_url = parsedURL2Str(current)->ptr;
if (DefaultURLString == DEFAULT_URL_CURRENT) {
url = c_url;
if (DecodeURL)
url = url_unquote_conv(url, 0);
}
if (DefaultURLString == DEFAULT_URL_CURRENT)
url = url_decode2(c_url, NULL);
else
pushHist(hist, c_url);
}
......@@ -4077,11 +4078,8 @@ goURL0(char *prompt, int relative)
char *a_url;
parseURL2(a->url, &p_url, current);
a_url = parsedURL2Str(&p_url)->ptr;
if (DefaultURLString == DEFAULT_URL_LINK) {
url = a_url;
if (DecodeURL)
url = url_unquote_conv(url, Currentbuf->document_charset);
}
if (DefaultURLString == DEFAULT_URL_LINK)
url = url_decode2(a_url, Currentbuf);
else
pushHist(hist, a_url);
}
......@@ -4089,15 +4087,22 @@ goURL0(char *prompt, int relative)
if (url != NULL)
SKIP_BLANKS(url);
}
#ifdef USE_M17N
if (url != NULL) {
if ((relative || *url == '#') && Currentbuf->document_charset)
url = wc_conv_strict(url, InnerCharset,
Currentbuf->document_charset)->ptr;
if (relative) {
no_referer_ptr = query_SCONF_NO_REFERER_FROM(&Currentbuf->currentURL);
current = baseURL(Currentbuf);
if ((no_referer_ptr && *no_referer_ptr) ||
current == NULL ||
current->scheme == SCM_LOCAL || current->scheme == SCM_LOCAL_CGI)
referer = NO_REFERER;
else
url = conv_to_system(url);
referer = parsedURL2Str(&Currentbuf->currentURL)->ptr;
url = url_encode(url, current, Currentbuf->document_charset);
}
else {
current = NULL;
referer = NULL;
url = url_encode(url, NULL, 0);
}
#endif
if (url == NULL || *url == '\0') {
displayBuffer(Currentbuf, B_FORCE_REDRAW);
return;
......@@ -4106,14 +4111,6 @@ goURL0(char *prompt, int relative)
gotoLabel(url + 1);
return;
}
if (relative) {
current = baseURL(Currentbuf);
referer = parsedURL2Str(&Currentbuf->currentURL)->ptr;
}
else {
current = NULL;
referer = NULL;
}
parseURL2(url, &p_url, current);
pushHashHist(URLHist, parsedURL2Str(&p_url)->ptr);
cmd_loadURL(url, current, referer, NULL);
......@@ -4510,8 +4507,7 @@ _peekURL(int only_img)
s = parsedURL2Str(&pu);
}
if (DecodeURL)
s = Strnew_charp(url_unquote_conv
(s->ptr, Currentbuf->document_charset));
s = Strnew_charp(url_decode2(s->ptr, Currentbuf));
#ifdef USE_M17N
s = checkType(s, &pp, NULL);
p = NewAtom_N(Lineprop, s->length);
......@@ -4570,7 +4566,7 @@ DEFUN(curURL, PEEK, "Peek current URL")
offset = 0;
s = currentURL();
if (DecodeURL)
s = Strnew_charp(url_unquote_conv(s->ptr, 0));
s = Strnew_charp(url_decode2(s->ptr, NULL));
#ifdef USE_M17N
s = checkType(s, &pp, NULL);
p = NewAtom_N(Lineprop, s->length);
......
......@@ -279,7 +279,7 @@ follow_map_panel(Buffer *buf, char *name)
p = parsedURL2Str(&pu)->ptr;
q = html_quote(p);
if (DecodeURL)
p = html_quote(url_unquote_conv(p, buf->document_charset));
p = html_quote(url_decode2(p, buf));
else
p = q;
Strcat_m_charp(mappage, "<tr valign=top><td><a href=\"", q, "\">",
......@@ -417,10 +417,7 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi)
continue;
parseURL2(a->url, &pu, baseURL(buf));
q = html_quote(parsedURL2Str(&pu)->ptr);
if (DecodeURL)
p = html_quote(url_unquote_conv(a->url, buf->document_charset));
else
p = html_quote(a->url);
p = html_quote(url_decode2(a->url, buf));
Strcat_m_charp(tmp, "<tr valign=top><td>&nbsp;&nbsp;<td><a href=\"",
q, "\">",
html_quote(*a->alt ? a->alt : mybasename(a->url)),
......@@ -457,10 +454,8 @@ append_link_info(Buffer *buf, Str html, LinkList * link)
Strcat_charp(html, "[Rev]");
if (!l->url)
url = "(empty)";
else if (DecodeURL)
url = html_quote(url_unquote_conv(l->url, buf->document_charset));
else
url = html_quote(l->url);
url = html_quote(url_decode2(l->url, buf));
Strcat_m_charp(html, "<td>", url, NULL);
if (l->ctype)
Strcat_m_charp(html, " (", html_quote(l->ctype), ")", NULL);
......@@ -498,8 +493,7 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level)
Strcat_charp(html, p);
}
if (