aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2004-07-15 16:44:37 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2004-07-15 16:44:37 +0000
commit4b06a174e42874a946d034d643bec45149bdff4e (patch)
treeca66034690f9806356b8358a266aa22b873d497c
parent[w3m-dev 04092] remove __CYGWIN__ && LANG == JA (diff)
downloadw3m-4b06a174e42874a946d034d643bec45149bdff4e.tar.gz
w3m-4b06a174e42874a946d034d643bec45149bdff4e.zip
[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>
-rw-r--r--ChangeLog11
-rw-r--r--fm.h3
-rw-r--r--main.c22
-rw-r--r--w3mbookmark.c20
4 files changed, 32 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 10d77b0..8d0b924 100644
--- 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
@@ -8518,4 +8527,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-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 $
diff --git a/fm.h b/fm.h
index 74a4734..288426a 100644
--- a/fm.h
+++ b/fm.h
@@ -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
*
@@ -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
index 726bee0..4ceb538 100644
--- a/main.c
+++ b/main.c
@@ -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
#include "fm.h"
#include <signal.h>
@@ -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
index 74d7203..b1c63bf 100644
--- a/w3mbookmark.c
+++ b/w3mbookmark.c
@@ -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 <stdio.h>
#include "config.h"
@@ -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");