[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>
This commit is contained in:
Fumitoshi UKAI
2004-07-15 16:44:37 +00:00
parent 055ad4c690
commit 4b06a174e4
4 changed files with 32 additions and 24 deletions
+10 -1
View File
@@ -1,3 +1,12 @@
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> 2004-07-16 WATANABE Katsuyuki <knabe@sannet.ne.jp>
* [w3m-dev 04092] remove __CYGWIN__ && LANG == JA * [w3m-dev 04092] remove __CYGWIN__ && LANG == JA
@@ -8518,4 +8527,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.930 2004/07/15 16:32:38 ukai Exp $ $Id: ChangeLog,v 1.931 2004/07/15 16:44:37 ukai Exp $
+2 -1
View File
@@ -1,4 +1,4 @@
/* $Id: fm.h,v 1.126 2004/07/15 16:32:38 ukai Exp $ */ /* $Id: fm.h,v 1.127 2004/07/15 16:44:37 ukai Exp $ */
/* /*
* w3m: WWW wo Miru utility * w3m: WWW wo Miru utility
* *
@@ -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 DisplayCharset init(DISPLAY_CHARSET);
global wc_ces DocumentCharset init(DOCUMENT_CHARSET); global wc_ces DocumentCharset init(DOCUMENT_CHARSET);
global wc_ces SystemCharset init(SYSTEM_CHARSET); global wc_ces SystemCharset init(SYSTEM_CHARSET);
global wc_ces BookmarkCharset init(SYSTEM_CHARSET);
global char ExtHalfdump init(FALSE); global char ExtHalfdump init(FALSE);
global char FollowLocale init(TRUE); global char FollowLocale init(TRUE);
global char UseContentCharset init(TRUE); global char UseContentCharset init(TRUE);
+9 -13
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.243 2004/07/15 16:32:38 ukai Exp $ */ /* $Id: main.c,v 1.244 2004/07/15 16:44:37 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -452,6 +452,7 @@ main(int argc, char **argv, char **envp)
SystemCharset = wc_guess_locale_charset(Locale, SystemCharset); SystemCharset = wc_guess_locale_charset(Locale, SystemCharset);
} }
auto_detect = WcOption.auto_detect; auto_detect = WcOption.auto_detect;
BookmarkCharset = DocumentCharset;
#endif #endif
if (!non_null(HTTP_proxy) && if (!non_null(HTTP_proxy) &&
@@ -4110,25 +4111,20 @@ DEFUN(adBmark, ADD_BOOKMARK, "Add current page to bookmark")
Str tmp; Str tmp;
FormList *request; 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(localCookie()))->ptr,
(Str_form_quote(Strnew_charp(BookmarkFile)))->ptr, (Str_form_quote(Strnew_charp(BookmarkFile)))->ptr,
(Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))-> (Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))->
ptr, ptr,
#ifdef USE_M17N #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, (Str_form_quote(wc_conv_strict(Currentbuf->buffername,
InnerCharset, InnerCharset,
WC_CES_EUC_JP)))->ptr); BookmarkCharset)))->ptr,
#else wc_ces_to_charset(BookmarkCharset));
(Str_form_quote(wc_conv_strict(Currentbuf->buffername,
InnerCharset,
SystemCharset)))->ptr);
#endif
#else #else
(Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr); (Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr);
#endif #endif
+10 -8
View File
@@ -1,4 +1,4 @@
/* $Id: w3mbookmark.c,v 1.10 2003/09/23 18:42:25 ukai Exp $ */ /* $Id: w3mbookmark.c,v 1.11 2004/07/15 16:44:37 ukai Exp $ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "config.h" #include "config.h"
@@ -52,18 +52,18 @@ static char end_section[] =
static char *Local_cookie = NULL; static char *Local_cookie = NULL;
void void
print_bookmark_panel(char *bmark, char *url, char *title) print_bookmark_panel(char *bmark, char *url, char *title, char *charset)
{ {
Str tmp, tmp2; Str tmp, tmp2;
FILE *f; FILE *f;
char *p; char *p;
#if LANG == JA if (charset == NULL) {
/* FIXME: gettextize here */
printf("Content-Type: text/html; charset=EUC-JP\n\n");
#else
printf("Content-Type: text/html\n\n"); printf("Content-Type: text/html\n\n");
#endif }
else {
printf("Content-Type: text/html; charset=%s\n\n", charset);
}
printf(bkmark_src1, html_quote(bmark), html_quote(Local_cookie)); printf(bkmark_src1, html_quote(bmark), html_quote(Local_cookie));
if ((f = fopen(bmark, "r")) != NULL) { if ((f = fopen(bmark, "r")) != NULL) {
printf("<tr><td>Section:<td><select name=\"section\">\n"); printf("<tr><td>Section:<td><select name=\"section\">\n");
@@ -188,6 +188,7 @@ main(int argc, char *argv[], char **envp)
char *bmark; char *bmark;
char *url; char *url;
char *title; char *title;
char *charset;
char *sent_cookie; char *sent_cookie;
p = getenv("REQUEST_METHOD"); p = getenv("REQUEST_METHOD");
@@ -224,12 +225,13 @@ main(int argc, char *argv[], char **envp)
bmark = expandPath(tag_get_value(cgiarg, "bmark")); bmark = expandPath(tag_get_value(cgiarg, "bmark"));
url = tag_get_value(cgiarg, "url"); url = tag_get_value(cgiarg, "url");
title = tag_get_value(cgiarg, "title"); title = tag_get_value(cgiarg, "title");
charset = tag_get_value(cgiarg, "charset");
if (bmark == NULL || url == NULL) if (bmark == NULL || url == NULL)
goto request_err; goto request_err;
if (mode && !strcmp(mode, "panel")) { if (mode && !strcmp(mode, "panel")) {
if (title == NULL) if (title == NULL)
title = ""; title = "";
print_bookmark_panel(bmark, url, title); print_bookmark_panel(bmark, url, title, charset);
} }
else if (mode && !strcmp(mode, "register")) { else if (mode && !strcmp(mode, "register")) {
printf("Content-Type: text/plain\n"); printf("Content-Type: text/plain\n");