home *** CD-ROM | disk | FTP | other *** search
- diff -urN dillo-0.7.0.old/Makefile.am dillo-0.7.0/Makefile.am
- --- dillo-0.7.0.old/Makefile.am Wed Jun 26 01:12:50 2002
- +++ dillo-0.7.0/Makefile.am Wed Nov 6 17:17:24 2002
- @@ -1,17 +1,21 @@
- SUBDIRS = doc src
-
- -EXTRA_DIST = ChangeLog.old dillorc
- +EXTRA_DIST = ChangeLog.old dillorc encodings
-
- install-data-local: dillorc
- -if [ -d $(DESTDIR)$(sysconfdir) ]; then \
- $(INSTALL_DATA) --backup=t $(srcdir)/dillorc $(DESTDIR)$(sysconfdir)/; \
- + $(INSTALL_DATA) --backup=t $(srcdir)/encodings $(DESTDIR)$(sysconfdir)/; \
- elif [ -d /etc/ ]; then \
- $(INSTALL_DATA) --backup=t $(srcdir)/dillorc /etc/; \
- + $(INSTALL_DATA) --backup=t $(srcdir)/encodings /etc/; \
- fi
-
- uninstall-local:
- -if [ -d $(DESTDIR)$(sysconfdir) ]; then \
- rm -f $(DESTDIR)$(sysconfdir)/dillorc*; \
- + rm -f $(DESTDIR)$(sysconfdir)/encodings*; \
- elif [ -d /etc/ ]; then \
- - rm -f /etc/dillorc*
- + rm -f /etc/dillorc*; \
- + rm -f /etc/encodings* ;\
- fi
- diff -urN dillo-0.7.0.old/encodings dillo-0.7.0/encodings
- --- dillo-0.7.0.old/encodings Thu Jan 1 03:00:00 1970
- +++ dillo-0.7.0/encodings Wed Nov 6 17:19:20 2002
- @@ -0,0 +1,18 @@
- +<enc value="ASCII">7-bit ASCII</enc>
- +<enc value="ISO8859-1">Western European (ISO 8859-1)</enc>
- +<enc value="ISO8859-15">Western European (ISO 8859-15)</enc>
- +<enc value="CP1252">Western European (CodePage1252)</enc>
- +<enc value="ISO8859-2">Central European (ISO 8859-2)</enc>
- +<enc value="CP1250">Central European (CodePage1250)</enc>
- +<enc value="ISO8859-3">Southern European (ISO 8859-3)</enc>
- +<enc value="KOI8-R">Cyrillic (KOI8-R)</enc>
- +<enc value="CP1251">Cyrillic (CodePage1251)</enc>
- +<enc value="IBM866">Cyrillic (IBM866)</enc>
- +<enc value="ISO8859-13">Baltic (ISO 8859-13)</enc>
- +<enc value="ISO8859-4">Baltic (ISO 8859-4)</enc>
- +<enc value="CP1257">Baltic (CodePage1257)</enc>
- +<enc value="ISO8859-10">Nordic (ISO 8859-10)</enc>
- +<enc value="ISO8859-14">Celtic (ISO 8859-14)</enc>
- +<enc value="KOI8-U">Ukraine (KOI8-U)</enc>
- +<enc value="UTF-8">Unicode (UTF-8)</enc>
- +<enc value="UTF-16">Unicode (UTF-16)</enc>
- diff -urN dillo-0.7.0.old/src/Makefile.am dillo-0.7.0/src/Makefile.am
- --- dillo-0.7.0.old/src/Makefile.am Sat Aug 3 18:22:22 2002
- +++ dillo-0.7.0/src/Makefile.am Wed Nov 6 17:20:38 2002
- @@ -55,6 +55,9 @@
- dw_tooltip.h \
- dw_widget.c \
- dw_widget.h \
- + encodings.c \
- + encodings.h \
- + encoding-types.h \
- findtext.c \
- findtext.h \
- web.c \
- diff -urN dillo-0.7.0.old/src/browser.h dillo-0.7.0/src/browser.h
- --- dillo-0.7.0.old/src/browser.h Sat Aug 10 17:13:17 2002
- +++ dillo-0.7.0/src/browser.h Wed Nov 6 17:20:22 2002
- @@ -4,10 +4,8 @@
- #include <sys/types.h>
- #include <gdk/gdk.h>
- #include <gtk/gtk.h>
- -
- #include "url.h" /* for DilloUrl */
- -
- -
- +#include "encodings-types.h"
- typedef struct _BrowserWindow BrowserWindow;
- typedef struct _DilloMenuPopup DilloMenuPopup;
-
- @@ -58,6 +56,9 @@
- /* The bookmarks menu so that we can add things to it. */
- GtkWidget *bookmarks_menu;
-
- + /* The encoding menu */
- + GtkWidget *enc_menu;
- +
- /* The "Headings" and "Anchors" menus */
- GtkWidget *pagemarks_menuitem;
- GtkWidget *pagemarks_menu;
- @@ -118,6 +119,10 @@
-
- /* The tag for the idle function that sets button sensitivity. */
- guint sens_idle_tag;
- +
- + /* encodings variable */
- + gchar* encoding; /* the selected character set (pointer to static content -don't free it*/
- + deConversion dcv; /* handle for character set conversion */
- };
-
-
- diff -urN dillo-0.7.0.old/src/dillo.c dillo-0.7.0/src/dillo.c
- --- dillo-0.7.0.old/src/dillo.c Sat Aug 24 04:29:49 2002
- +++ dillo-0.7.0/src/dillo.c Wed Nov 6 17:26:55 2002
- @@ -22,6 +22,13 @@
- #include <stdio.h>
- #include <gtk/gtk.h>
-
- +#ifdef HAVE_LANGINFO
- +#include <langinfo.h>
- +#if ! defined(CODESET) && defined (_NL_CTYPE_CODESET_NAME)
- +#define CODESET _NL_CTYPE_CODESET_NAME
- +#endif
- +#endif
- +
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <string.h>
- @@ -37,6 +44,7 @@
- #include "nav.h"
- #include "history.h"
- #include "bookmark.h"
- +#include "encodings.h"
- #include "dicache.h"
- #include "dns.h"
- #include "IO/Url.h"
- @@ -61,6 +69,7 @@
- gint main(int argc, char *argv[])
- {
- gchar *file;
- + gchar *loctmp;
- DilloUrl *start_url;
- BrowserWindow *bw;
-
- @@ -68,7 +77,21 @@
- * todo: implement a cleaner mechanism (in file.c) */
- signal(SIGPIPE, SIG_IGN);
-
- - g_print("Setting locale to %s\n", gtk_set_locale());
- + curr_locale=gtk_set_locale();
- +#ifdef HAVE_LANGINFO
- + curr_locale = nl_langinfo(CODESET);
- +#else
- + loctmp = strchr(curr_locale, '.');
- + if (loctmp != NULL) {
- + gchar** trk = g_strsplit(++loctmp, ";", 1);
- + curr_locale = g_strdup(trk[0]);
- + g_strfreev(trk);
- + } else {
- + curr_locale = "ASCII";
- + }
- +#endif
- +
- + g_print("Setting locale to %s\n",curr_locale);
- gtk_init(&argc, &argv);
- gdk_rgb_init();
-
- @@ -92,6 +115,7 @@
- bw = a_Interface_browser_window_new(prefs.width, prefs.height);
-
- a_Bookmarks_init();
- + a_Encodings_init();
-
- /* Send dillo startup screen */
- start_url = a_Url_new("splash", "about:", 0, 0);
- diff -urN dillo-0.7.0.old/src/dillo.h dillo-0.7.0/src/dillo.h
- --- dillo-0.7.0.old/src/dillo.h Sat Aug 10 17:13:21 2002
- +++ dillo-0.7.0/src/dillo.h Wed Nov 6 17:27:02 2002
- @@ -6,4 +6,5 @@
-
- #define DILLO_HOME "http://dillo.cipsga.org.br/"
-
- +char* curr_locale;
- #endif /* __DILLO_H__ */
- diff -urN dillo-0.7.0.old/src/encodings-types.h dillo-0.7.0/src/encodings-types.h
- --- dillo-0.7.0.old/src/encodings-types.h Thu Jan 1 03:00:00 1970
- +++ dillo-0.7.0/src/encodings-types.h Wed Nov 6 17:29:06 2002
- @@ -0,0 +1,19 @@
- +#ifndef __DILLO_ENCODING_TYPES_H__
- +#define __DILLO_ENCODING_TYPES_H__
- +#include <iconv.h>
- +/* Copyright (C) 2002 Grigory Bakunov <black@asplinux.ru> */
- +
- +typedef struct _deConversion deConversion;
- +
- +struct _deConversion {
- + iconv_t c_from;
- + iconv_t c_to;
- +};
- +
- +
- +typedef enum {
- + DE_DECODE,
- + DE_ENCODE
- +} deDirection;
- +
- +#endif /* __DILLO_ENCODING_TYPES_H__ */
- diff -urN dillo-0.7.0.old/src/encodings.c dillo-0.7.0/src/encodings.c
- --- dillo-0.7.0.old/src/encodings.c Thu Jan 1 03:00:00 1970
- +++ dillo-0.7.0/src/encodings.c Wed Nov 6 17:25:20 2002
- @@ -0,0 +1,376 @@
- +/* cruelty :) */
- +
- +/* Copyright (C) 2002 Grigory Bakunov <black@asplinux.ru> */
- +
- +/* Copyright (C) 1997 Ian Main
- + *
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2 of the License, or
- + * (at your option) any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- + */
- +
- +#include <gtk/gtk.h>
- +
- +#include <errno.h>
- +#include <stdio.h>
- +#include <stdlib.h>
- +#include <string.h>
- +
- +#include "list.h"
- +#include "interface.h"
- +#include "dillo.h"
- +#include "nav.h"
- +#include "browser.h"
- +#include "menu.h"
- +#include "misc.h"
- +#include "url.h"
- +
- +#define LOAD_ENCODINGS 1
- +#define SAVE_ENCODING 2
- +#define CLOSE_ENCODINGS 3
- +
- +/* this #define will cut page title if > 39 chars */
- +#define TITLE39
- +
- +/* double quote */
- +#define D_QUOTE 0x22
- +
- +/* Data types */
- +
- +typedef struct _Encoding Encoding;
- +typedef struct _CallbackInfo CallbackInfo;
- +
- +struct _Encoding {
- + char *title;
- + char *iconv_name;
- + GtkWidget *menuitem;
- +};
- +
- +struct _CallbackInfo {
- + BrowserWindow *bw;
- + guint index;
- +};
- +
- +/*
- + * Forward declarations
- + */
- +static void
- + Encodings_load_to_menu(FILE *fp),
- + Encodings_file_op(gint operation, const char *title, const char *iconv_name),
- + Encodings_save_to_file(FILE *fp, const char *title, const char *iconv_name);
- +
- +static char*
- + Encodings_search_line(char *line, char *start_text, char *end_text);
- +
- +/*
- + * Local data
- + */
- +static Encoding *encodings = NULL;
- +static gint num_encodings = 0;
- +static gint num_encodings_max = 16;
- +
- +
- +/*
- + * Allocate memory and load the encodings list
- + */
- +void a_Encodings_init(void)
- +{
- + gchar *file;
- +
- + /* Here we load and set the encodings */
- + file = a_Misc_prepend_user_home(".dillo/encodings");
- + Encodings_file_op(LOAD_ENCODINGS, file, NULL);
- + g_free(file);
- +}
- +
- +/*
- + * ?
- + */
- +void Encodings_set_encoding(GtkWidget *widget, CallbackInfo *CbInfo)
- +{
- + if (CbInfo->index >= num_encodings) {
- + g_warning("encoding not found!\n");
- + return;
- + }
- + g_print("Selected encoding: %s\n",encodings[CbInfo->index].iconv_name);
- + CbInfo->bw->encoding=encodings[CbInfo->index].iconv_name;
- + a_Nav_reload(CbInfo->bw);
- + /*HERE!!! LOOKOUT!!!! */
- +}
- +
- +/*
- + * Add a encoding to the encodings menu of a particular browser window
- + */
- +void Encodings_add_to_menu(BrowserWindow *bw, GtkWidget *menuitem, guint index)
- +{
- + CallbackInfo *CbInfo;
- +
- + gtk_menu_append(GTK_MENU(bw->enc_menu), menuitem);
- +
- + CbInfo = g_new(CallbackInfo, 1);
- + CbInfo->bw = bw;
- + CbInfo->index = index;
- +
- + /* accelerator goes here */
- + gtk_signal_connect(GTK_OBJECT (menuitem), "activate",
- + (GtkSignalFunc)Encodings_set_encoding, CbInfo);
- +}
- +
- +/*
- + * ?
- + */
- +static GtkWidget *Encodings_insert(const char *title, const char *iconv_name)
- +{
- + GtkWidget *menuitem;
- +
- + menuitem = gtk_menu_item_new_with_label(title);
- + gtk_widget_show(menuitem);
- +
- + a_List_add(encodings, num_encodings, num_encodings_max);
- + encodings[num_encodings].title = g_strdup(title);
- + encodings[num_encodings].iconv_name = g_strdup(iconv_name);
- + encodings[num_encodings].menuitem = menuitem;
- + num_encodings++;
- + return menuitem;
- +}
- +
- +/*
- + * Add the new encoding to encodings menu of _all_ browser windows and then
- + * write the new encoding to file
- + */
- +/*
- +void a_Encodings_add(GtkWidget *widget, gpointer client_data)
- +{
- + BrowserWindow *bw = (BrowserWindow *)client_data;
- + gint i;
- +#ifdef TITLE39
- + gboolean allocated = FALSE;
- +#endif
- + char *title;
- + char *iconv_name;
- + GtkWidget *menuitem;
- +
- + title = bw->menu_popup.info.title;
- + iconv_name = bw->menu_popup.info.iconv_name;
- +
- +#ifdef TITLE39
- + if (strlen (title) > 39) {
- + char buf1[20];
- + char buf2[20];
- +
- + memcpy (buf1, title, 18);
- + buf1[18] = '\0';
- + strcpy (buf2, title + strlen (title) - 18);
- + buf2[18] = '\0';
- + title = g_strconcat (buf1, "...", buf2, NULL);
- + allocated = TRUE;
- + }
- +#endif
- +
- + menuitem = Encodings_insert(title, iconv_name);
- + Encodings_add_to_menu(browser_window[0], menuitem, num_encodings-1);
- + for (i = 1; i < num_bw; i++) {
- + menuitem= gtk_menu_item_new_with_label(encodings[num_encodings-1].title);
- + gtk_widget_show(menuitem);
- + Encodings_add_to_menu(browser_window[i], menuitem, num_encodings-1);
- + }
- +
- + Encodings_file_op(SAVE_ENCODING, title, iconv_name);
- +
- +#ifdef TITLE39
- + if (allocated)
- + g_free (title);
- +#endif
- +}
- +*/
- +/*
- + * Never called (the file remains open all the time) --Jcid
- + */
- +void Encodings_close(void)
- +{
- + Encodings_file_op(CLOSE_ENCODINGS, NULL, NULL);
- +}
- +
- +/*
- + * Performs operations on the encoding file..
- + * for first call, title is the filename
- + */
- +static void
- + Encodings_file_op(gint operation, const char *title, const char *iconv_name)
- +{
- + static FILE *fp;
- + static gint initialized = 0;
- +
- + if (!initialized) {
- + if (operation == LOAD_ENCODINGS) {
- + if ((fp = fopen(title, "a+")) == NULL)
- + g_print("dillo: opening encoding file %s: %s\n",
- + title, strerror(errno));
- + else
- + initialized = 1;
- + } else
- + g_print("Error: invalid call to Encodings_file_op.\n");
- + }
- +
- + g_return_if_fail( initialized );
- +
- + switch (operation) {
- + case LOAD_ENCODINGS:
- + Encodings_load_to_menu(fp);
- + break;
- +
- + case SAVE_ENCODING:
- + Encodings_save_to_file(fp, title, iconv_name);
- + break;
- +
- + case CLOSE_ENCODINGS:
- + fclose(fp);
- + break;
- +
- + default:
- + break;
- + }
- +}
- +
- +/*
- + * Save encodings to ~/.dillo/encodings
- + */
- +static void
- + Encodings_save_to_file(FILE *fp, const char *title, const char* iconv_name)
- +{
- + fseek(fp, 0L, SEEK_END);
- + fprintf(fp, "<enc value=\"%s\">%s</a>\n", iconv_name,title);
- + fflush(fp);
- +}
- +
- +/*
- + * Load encodings
- + */
- +static void Encodings_load_to_menu(FILE *fp)
- +{
- + gchar *title=NULL;
- + gchar *iconv_name=NULL;
- + char buf[4096];
- + gint i = 0;
- + GtkWidget *menuitem;
- +
- + rewind(fp);
- +
- + g_print("Loading encodings...\n");
- + while (1) {
- + /* Read a whole line from the file */
- + if ((fgets(buf, 4096, fp)) == NULL)
- + break;
- +
- + /* get url from line */
- + if ( !(iconv_name = Encodings_search_line(buf, "=\"", "\">")) )
- + continue;
- +
- + /* get title from line */
- + if ( !(title = Encodings_search_line(buf, "\">", "</")) ){
- + g_free(iconv_name);
- + continue;
- + }
- + printf("%s = %s\n",title,iconv_name);
- + menuitem = Encodings_insert(title, iconv_name);
- + Encodings_add_to_menu(browser_window[0], menuitem, i);
- + g_free(iconv_name);
- + g_free(title);
- + i++;
- + }
- +}
- +
- +/*
- + * Copy encodings when new browser windows are opened.
- + * Called by 'a_Menu_mainbar_new()'
- + */
- +void a_Encodings_fill_new_menu(BrowserWindow *bw)
- +{
- + gint i;
- + GtkWidget *menuitem;
- +
- + for (i = 0; i < num_encodings; i++) {
- + menuitem = gtk_menu_item_new_with_label(encodings[i].title);
- + gtk_widget_show(menuitem);
- + Encodings_add_to_menu(bw, menuitem, i);
- + }
- +}
- +
- +static char *
- + Encodings_search_line(char *line, char *start_text, char *end_text) {
- + gint segment_length;
- + char *start_index, *end_index;
- +
- + /* if string is not found, return NULL */
- + if ((start_index = strstr(line, start_text)) == NULL)
- + return (NULL);
- + if ((end_index = strstr(line, end_text)) == NULL)
- + return (NULL);
- +
- + /* adjustment cause strstr returns the start of the text */
- + start_index += strlen(start_text);
- +
- + /* find length of text segment */
- + segment_length = end_index - start_index;
- + return g_strndup(start_index, segment_length);
- +};
- +
- +void a_Encoding_get_conversion(BrowserWindow *bw, char* charset) {
- + bw->dcv.c_from=iconv_open(curr_locale,charset);
- + bw->dcv.c_to=iconv_open(charset,curr_locale);
- + if (bw->dcv.c_from == (iconv_t)-1 || bw->dcv.c_to == (iconv_t)-1)
- + g_warning ("could not allocate character encoding converter.");
- + return;
- +};
- +
- +#define MAX_CHAR_SIZE 4
- +gchar *a_Encoding_translate_encoding(deConversion dcv, gchar *buf, gint bufsize,deDirection dir) {
- + char *result, *source, *dest;
- + size_t s_left, d_left;
- + iconv_t conversion;
- + if (dir==DE_DECODE)
- + conversion=dcv.c_from;
- + else
- + conversion=dcv.c_to;
- + /* no conversion is needed, or none is available */
- + if (conversion == (iconv_t)-1)
- + return g_strndup(buf, bufsize);
- +
- + /* Note that for some conversions, the translated buffer can be larger
- + * than the input buffer. This is particularly important for conversions
- + * to UTF8 (check the unicode standard to find out the scale factor). */
- + result = g_malloc((bufsize + 1)*MAX_CHAR_SIZE);
- +
- + source = buf;
- + dest = result;
- + s_left = bufsize;
- + d_left = bufsize*MAX_CHAR_SIZE;
- + if (iconv(conversion, &source, &s_left, &dest, &d_left)
- + == (size_t)-1) {
- + g_warning ("unable to fully convert page to native character set");
- + /* This just skips past unconvertable characters, putting "?" in the
- + * output, then retries the conversion. This is a hack, but it seems
- + * like the best course of action in the circumstances. */
- + while (s_left > 0 && d_left > 0 && errno == EILSEQ) {
- + source++;
- + s_left--;
- + *dest = '?';
- + dest++;
- + d_left--;
- + if (s_left > 0 && d_left > 0)
- + iconv(conversion, &source, &s_left, &dest, &d_left);
- + }
- + }
- + *dest = 0; /* terminate the string */
- + return result;
- +}
- diff -urN dillo-0.7.0.old/src/encodings.h dillo-0.7.0/src/encodings.h
- --- dillo-0.7.0.old/src/encodings.h Thu Jan 1 03:00:00 1970
- +++ dillo-0.7.0/src/encodings.h Wed Nov 6 17:26:05 2002
- @@ -0,0 +1,18 @@
- +#ifndef __DILLO_ENCODING_H__
- +#define __DILLO_ENCODING_H__
- +#include <gtk/gtk.h>
- +#include <iconv.h>
- +#include "browser.h"
- +#include "encodings-types.h"
- +
- +
- +/* Copyright (C) 2002 Grigory Bakunov <black@asplinux.ru> */
- +
- +void a_Encodings_init();
- +void a_Encodings_add(GtkWidget *widget, gpointer client_data);
- +void a_Encodings_fill_new_menu(BrowserWindow *bw);
- +void a_Encoding_get_conversion(BrowserWindow *bw, char* charset);
- +char *a_Encoding_translate_encoding(deConversion dcv, char *buf,
- + gint bufsize,deDirection dir);
- +
- +#endif /* __DILLO_ENCODING_H__ */
- diff -urN dillo-0.7.0.old/src/html.c dillo-0.7.0/src/html.c
- --- dillo-0.7.0.old/src/html.c Mon Oct 21 20:01:38 2002
- +++ dillo-0.7.0/src/html.c Wed Nov 6 17:27:08 2002
- @@ -21,6 +21,7 @@
- #include <stdlib.h>
- #include <stdio.h> /* for sprintf */
- #include <math.h> /* for rint */
- +#include <errno.h> /* for iconv error codes */
-
- #include <gtk/gtk.h>
-
- @@ -47,6 +48,7 @@
- #include "progressbar.h"
- #include "prefs.h"
- #include "misc.h"
- +#include "encodings.h"
- #include "capi.h"
-
- #define DEBUG_LEVEL 10
- @@ -2763,7 +2765,7 @@
- if ((form->method == DILLO_HTML_METHOD_GET) ||
- (form->method == DILLO_HTML_METHOD_POST)) {
- GString *DataStr = g_string_sized_new(4096);
- -
- + GString *DataStrEnc;
- DEBUG_MSG(3,"Html_submit_form form->action=%s\n",URL_STR_(form->action));
-
- for (input_index = 0; input_index < form->num_inputs; input_index++) {
- @@ -2827,6 +2829,12 @@
- break;
- } /* switch */
- } /* for (inputs) */
- + DataStrEnc = g_string_new(a_Encoding_translate_encoding(html_lb->bw->dcv,
- + DataStr -> str,
- + DataStr -> len,
- + DE_ENCODE));
- + g_string_free(DataStr,TRUE);
- + DataStr = DataStrEnc;
-
- if ( DataStr->str[DataStr->len - 1] == '&' )
- g_string_truncate(DataStr, DataStr->len - 1);
- @@ -3908,6 +3916,22 @@
- Html_write(Client->CbData, Client->Buf, Client->BufSize, 0);
- }
-
- +static void Html_set_encoding(DilloHtml *html, char *buf, gint bufsize) {
- + /* only do _anything_ if told so */
- + if (html->bw->encoding != NULL)
- + a_Encoding_get_conversion(html->bw, html->bw->encoding);
- + return;
- +}
- +
- +static char *Html_translate_encoding(DilloHtml *html, char *buf,
- + gint bufsize) {
- + char* result=a_Encoding_translate_encoding(html->bw->dcv,
- + buf, bufsize,
- + DE_DECODE);
- + return result;
- +
- +}
- +
- /*
- * Here's where we parse the html and put it into the page structure.
- * (This function is called by Html_callback whenever there's new data)
- @@ -3919,12 +3943,18 @@
- char completestr[32];
- gint token_start, buf_index;
- char *buf = Buf + html->Start_Ofs;
- + char *buf_encoded;
- gint bufsize = BufSize - html->Start_Ofs;
- -
- +
- g_return_if_fail ( (page = DW_PAGE (html->dw)) != NULL );
-
- buf = g_strndup(buf, bufsize);
-
- + Html_set_encoding(html, buf, bufsize);
- + buf_encoded=buf;
- + buf = Html_translate_encoding(html, buf, bufsize);
- + g_free(buf_encoded);
- +
- /* Now, 'buf' and 'bufsize' define a buffer aligned to start at a token
- * boundary. Iterate through tokens until end of buffer is reached. */
- buf_index = 0;
- diff -urN dillo-0.7.0.old/src/interface.c dillo-0.7.0/src/interface.c
- --- dillo-0.7.0.old/src/interface.c Mon Oct 7 01:53:15 2002
- +++ dillo-0.7.0/src/interface.c Wed Nov 6 17:27:09 2002
- @@ -17,6 +17,7 @@
- #include <sys/stat.h>
- #include <sys/time.h>
- #include <fcntl.h>
- +#include <iconv.h>
-
- #include "list.h"
- #include "dillo.h"
- @@ -766,6 +767,9 @@
- bw->question_dialog_window = NULL;
- bw->question_dialog_data = NULL;
- bw->viewsource_window = NULL;
- + bw->encoding=NULL;
- + bw->dcv.c_from = (iconv_t)-1; /* no conversion yet */
- + bw->dcv.c_to = (iconv_t)-1;
-
- /* now that the bw is made, let's customize it.. */
- Interface_browser_window_customize(bw);
- diff -urN dillo-0.7.0.old/src/menu.c dillo-0.7.0/src/menu.c
- --- dillo-0.7.0.old/src/menu.c Sat Aug 10 17:13:36 2002
- +++ dillo-0.7.0/src/menu.c Wed Nov 6 17:26:52 2002
- @@ -31,6 +31,7 @@
- #include "dw_page.h" /* for a_Dw_page_add_anchor */
- #include "bookmark.h"
- #include "interface.h"
- +#include "encodings.h"
-
- /*
- * Forward declarations
- @@ -121,6 +122,8 @@
- GtkWidget *menubar;
- GtkWidget *file_menu;
- GtkWidget *bookmarks_menu;
- + GtkWidget *enc_menu;
- +
- /* GtkWidget *help_menu; */
-
- bw->menubar = menubar = gtk_menu_bar_new();
- @@ -157,6 +160,10 @@
- Menu_add(help_menu, "Dillo _Manual", NULL, bw,
- a_Commands_manual_callback, bw);
- */
- + enc_menu = Menu_new(menubar, tiny ? "_E" : "_Encodings", FALSE, bw);
- + bw->enc_menu = enc_menu;
- + a_Encodings_fill_new_menu(bw);
- +
- return menubar;
- }
-
-