[w3m-dev 04093] bookmark charset
WATANABE Katsuyuki <[email protected]>
| Newsgroups | gmane.comp.web.w3m.devel |
|---|---|
| Message-ID | <[email protected]> |
$BEOn5$G$9!#(B
$B%V%C%/%^!<%/$N%-%c%i%/%?%;%C%H$rDI2C$7!"(B
w3mbookamrk $B$r8F$V;~$K%?%$%H%k$r%(%s%3!<%I!"%-%c%i%/%?%;%C%H$H(B
$B0l=o$KEO$9$h$&$K$7$F$_$^$7$?!#(B
$B$H$j$"$($:CM$O(B DocumentCharset $B$HF1$8$K$7$F$$$^$9!#(B
* 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.
diff -urN w3m-0.5.1/fm.h w3m-0.5.1-bkmk/fm.h
--- w3m-0.5.1/fm.h 2004-04-17 03:47:20.000000000 +0900
+++ w3m-0.5.1-bkmk/fm.h 2004-07-14 19:30:46.000000000 +0900
@@ -1009,6 +1009,7 @@
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 -urN w3m-0.5.1/main.c w3m-0.5.1-bkmk/main.c
--- w3m-0.5.1/main.c 2004-04-05 01:47:20.000000000 +0900
+++ w3m-0.5.1-bkmk/main.c 2004-07-14 19:30:40.000000000 +0900
@@ -452,6 +452,7 @@
SystemCharset = wc_guess_locale_charset(Locale, SystemCharset);
}
auto_detect = WcOption.auto_detect;
+ BookmarkCharset = DocumentCharset;
#endif
if (!non_null(HTTP_proxy) &&
@@ -4110,25 +4111,20 @@
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 -urN w3m-0.5.1/w3mbookmark.c w3m-0.5.1-bkmk/w3mbookmark.c
--- w3m-0.5.1/w3mbookmark.c 2003-09-24 03:42:26.000000000 +0900
+++ w3m-0.5.1-bkmk/w3mbookmark.c 2004-07-14 18:29:14.000000000 +0900
@@ -52,18 +52,18 @@
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 @@
char *bmark;
char *url;
char *title;
+ char *charset;
char *sent_cookie;
p = getenv("REQUEST_METHOD");
@@ -224,12 +225,13 @@
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");