w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit f5877bef559b5111a9ea1854aafd493e02aebf2f
parent e443412fe59383f52c9bb5eab217f13c4e1ef113
Author: ukai <ukai>
Date:   Thu, 15 Jul 2004 16:44:37 +0000

[w3m-dev 04093] bookmark charset
* add global variable: BookmarkCharset.
* main.c:adBmark(): remove condition LANG = JA.
* main.c: buffername encode by BookmarkCharset when add bookmark.
* main.c: BookmarkCharset pass to w3mbookmark.
* w3mbookmark.c: ditto.
From: WATANABE Katsuyuki <knabe@sannet.ne.jp>

Diffstat:
MChangeLog | 9+++++++++
Mfm.h | 1+
Mmain.c | 20++++++++------------
Mw3mbookmark.c | 18++++++++++--------
4 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,14 @@ 2004-07-16 WATANABE Katsuyuki <knabe@sannet.ne.jp> + * [w3m-dev 04093] bookmark charset + * add global variable: BookmarkCharset. + * main.c:adBmark(): remove condition LANG = JA. + * main.c: buffername encode by BookmarkCharset when add bookmark. + * main.c: BookmarkCharset pass to w3mbookmark. + * w3mbookmark.c: ditto. + +2004-07-16 WATANABE Katsuyuki <knabe@sannet.ne.jp> + * [w3m-dev 04092] remove __CYGWIN__ && LANG == JA * remove condition LANG == JA && __CYGWIN__ * cygwin_mouse_btn_swapped enabled when before 1.5.x diff --git a/fm.h b/fm.h @@ -1009,6 +1009,7 @@ global wc_ces InnerCharset init(WC_CES_WTF); /* Don't change */ global wc_ces DisplayCharset init(DISPLAY_CHARSET); global wc_ces DocumentCharset init(DOCUMENT_CHARSET); global wc_ces SystemCharset init(SYSTEM_CHARSET); +global wc_ces BookmarkCharset init(SYSTEM_CHARSET); global char ExtHalfdump init(FALSE); global char FollowLocale init(TRUE); global char UseContentCharset init(TRUE); diff --git a/main.c b/main.c @@ -452,6 +452,7 @@ main(int argc, char **argv, char **envp) SystemCharset = wc_guess_locale_charset(Locale, SystemCharset); } auto_detect = WcOption.auto_detect; + BookmarkCharset = DocumentCharset; #endif if (!non_null(HTTP_proxy) && @@ -4110,25 +4111,20 @@ DEFUN(adBmark, ADD_BOOKMARK, "Add current page to bookmark") Str tmp; FormList *request; - tmp = Sprintf("mode=panel&cookie=%s&bmark=%s&url=%s&title=%s", + tmp = Sprintf("mode=panel&cookie=%s&bmark=%s&url=%s&title=%s" +#ifdef USE_M17N + "&charset=%s" +#endif + , (Str_form_quote(localCookie()))->ptr, (Str_form_quote(Strnew_charp(BookmarkFile)))->ptr, (Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))-> ptr, #ifdef USE_M17N -#if LANG == JA - /* FIXME: why WC_CES_EUC_JP hardcoded? - * backward compatibility. - * w3mbookmark takes arguments as EUC-JP only? - */ (Str_form_quote(wc_conv_strict(Currentbuf->buffername, InnerCharset, - WC_CES_EUC_JP)))->ptr); -#else - (Str_form_quote(wc_conv_strict(Currentbuf->buffername, - InnerCharset, - SystemCharset)))->ptr); -#endif + BookmarkCharset)))->ptr, + wc_ces_to_charset(BookmarkCharset)); #else (Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr); #endif diff --git a/w3mbookmark.c b/w3mbookmark.c @@ -52,18 +52,18 @@ static char end_section[] = static char *Local_cookie = NULL; void -print_bookmark_panel(char *bmark, char *url, char *title) +print_bookmark_panel(char *bmark, char *url, char *title, char *charset) { Str tmp, tmp2; FILE *f; char *p; -#if LANG == JA - /* FIXME: gettextize here */ - printf("Content-Type: text/html; charset=EUC-JP\n\n"); -#else - printf("Content-Type: text/html\n\n"); -#endif + if (charset == NULL) { + printf("Content-Type: text/html\n\n"); + } + else { + printf("Content-Type: text/html; charset=%s\n\n", charset); + } printf(bkmark_src1, html_quote(bmark), html_quote(Local_cookie)); if ((f = fopen(bmark, "r")) != NULL) { printf("<tr><td>Section:<td><select name=\"section\">\n"); @@ -188,6 +188,7 @@ main(int argc, char *argv[], char **envp) char *bmark; char *url; char *title; + char *charset; char *sent_cookie; p = getenv("REQUEST_METHOD"); @@ -224,12 +225,13 @@ main(int argc, char *argv[], char **envp) bmark = expandPath(tag_get_value(cgiarg, "bmark")); url = tag_get_value(cgiarg, "url"); title = tag_get_value(cgiarg, "title"); + charset = tag_get_value(cgiarg, "charset"); if (bmark == NULL || url == NULL) goto request_err; if (mode && !strcmp(mode, "panel")) { if (title == NULL) title = ""; - print_bookmark_panel(bmark, url, title); + print_bookmark_panel(bmark, url, title, charset); } else if (mode && !strcmp(mode, "register")) { printf("Content-Type: text/plain\n");