]> git.pld-linux.org Git - packages/dillo.git/commitdiff
- patch by Alexey Tourbin
authorjuandon <witekfl@pld-linux.org>
Mon, 3 Mar 2003 09:08:46 +0000 (09:08 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dillo-0.7.0-alt-asp-charset-encodings-sysconfdir.patch -> 1.1

dillo-0.7.0-alt-asp-charset-encodings-sysconfdir.patch [new file with mode: 0644]

diff --git a/dillo-0.7.0-alt-asp-charset-encodings-sysconfdir.patch b/dillo-0.7.0-alt-asp-charset-encodings-sysconfdir.patch
new file mode 100644 (file)
index 0000000..f309841
--- /dev/null
@@ -0,0 +1,875 @@
+--- dillo-0.7.0~/dillorc       2003-02-13 23:59:30 +0300
++++ dillo-0.7.0/dillorc        2003-02-21 03:15:45 +0300
+@@ -35,6 +35,9 @@
+ # If you prefer oblique over italic fonts, uncoment next line
+ #use_oblique=YES
++# Use this value as charset part of font for loading. (default is iso8859-1)
++# font_charset=iso8859-5
++
+ # Show tooltip popup for images?
+ # Note: We use the "title" attribute and not "alt".
+ #       More info at: http://bugzilla.mozilla.org/show_bug.cgi?id=25537
+--- dillo-0.7.0~/encodings     1970-01-01 03:00:00 +0300
++++ dillo-0.7.0/encodings      2003-02-21 03:15:46 +0300
+@@ -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>
+--- dillo-0.7.0~/Makefile.am   2003-02-13 23:56:11 +0300
++++ dillo-0.7.0/Makefile.am    2003-02-21 03:15:46 +0300
+@@ -1,17 +1,21 @@
+ SUBDIRS = doc src dpi
+   
+-EXTRA_DIST = ChangeLog.old dillorc
++EXTRA_DIST = ChangeLog.old dillorc encodings
+ install-data-local: dillorc
+       -if [ -d $(DESTDIR)$(sysconfdir) ]; then \
+               $(INSTALL_DATA) -b $(srcdir)/dillorc $(DESTDIR)$(sysconfdir)/; \
++              $(INSTALL_DATA) --backup=t $(srcdir)/encodings $(DESTDIR)$(sysconfdir)/; \
+       elif [ -d /etc/ ]; then \
+               $(INSTALL_DATA) -b $(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/encodings* ;\
+       fi
+--- dillo-0.7.0~/src/browser.h 2003-02-10 16:10:30 +0300
++++ dillo-0.7.0/src/browser.h  2003-02-21 03:15:46 +0300
+@@ -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;
+@@ -61,6 +59,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;
+@@ -121,6 +122,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 */
+ };
+--- dillo-0.7.0~/src/dillo.c   2003-02-09 03:22:14 +0300
++++ dillo-0.7.0/src/dillo.c    2003-02-21 03:15:46 +0300
+@@ -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>
+@@ -39,6 +46,7 @@
+ #include "nav.h"
+ #include "history.h"
+ #include "bookmark.h"
++#include "encodings.h"
+ #include "dicache.h"
+ #include "dns.h"
+ #include "IO/mime.h"
+@@ -171,7 +179,7 @@
+  */
+ gint main(int argc, char *argv[])
+ {
+-   gchar *file, *curr_locale;
++   gchar *file, *loctmp;
+    DilloUrl *start_url;
+    BrowserWindow *bw;
+    guint32 xid = 0;
+@@ -181,9 +189,6 @@
+    gint i;
+    char **opt_argv = NULL;
+-   /* set locale */
+-   curr_locale = g_strdup(setlocale(LC_ALL, NULL));
+-   gtk_set_locale();
+    /* Initialize GUI and parse GTK related args */
+    gtk_init(&argc, &argv);
+    gdk_rgb_init();
+@@ -219,9 +224,21 @@
+      }
+    }
+-   /* Send a delayed locale-related message */
+-   g_print("Setting locale to %s...\n", curr_locale);
+-   g_free(curr_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);
+    /* This lets threads in the file module end peacefully when aborted
+     * todo: implement a cleaner mechanism (in file.c) */
+@@ -255,6 +272,7 @@
+    bw = a_Interface_browser_window_new(prefs.width, prefs.height, xid);
+    a_Bookmarks_init();
++   a_Encodings_init();
+    /* Send dillo startup screen */
+    start_url = a_Url_new("splash", "about:", 0, 0);
+--- dillo-0.7.0~/src/dillo.h   2002-11-28 19:42:22 +0300
++++ dillo-0.7.0/src/dillo.h    2003-02-21 03:15:46 +0300
+@@ -4,4 +4,5 @@
+ #include "browser.h"
+ #include "web.h"
++char* curr_locale;
+ #endif /* __DILLO_H__ */
+diff -ubBdr -N dillo-0.7.0~/src/dillo.h.orig dillo-0.7.0/src/dillo.h.orig
+--- dillo-0.7.0~/src/dw_style.c        2003-01-05 22:24:06 +0300
++++ dillo-0.7.0/src/dw_style.c 2003-02-21 03:15:45 +0300
+@@ -245,42 +245,39 @@
+    char fontname[256], *ItalicChar;
+    ItalicChar = prefs.use_oblique ? "o" : "i";
+-   sprintf (fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-iso8859-1",
++   sprintf (fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-%s",
+             font->name,
+             font->bold ? "bold" : "medium",
+             font->italic ? ItalicChar : "r",
+-            font->size);
++            font->size,prefs.font_charset);
+    font->font = gdk_font_load (fontname);
+    if (font->font == NULL && font->italic) {
+-      sprintf (fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-iso8859-1",
++      sprintf (fontname, "-*-%s-%s-%s-*-*-%d-*-75-75-*-*-%s",
+                font->name,
+                font->bold ? "bold" : "medium",
+                (*ItalicChar == 'o') ? "i" : "o",
+-               font->size);
++               font->size,prefs.font_charset);
+       font->font = gdk_font_load (fontname);
+    }
+    if (try_all) {
+       if (font->font == NULL) {
+          /* Can't load the font - substitute the default instead. */
+-         font->font =
+-            gdk_font_load
+-            ("-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-iso8859-1");
++         sprintf(fontname,"-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-%s",prefs.font_charset);
++         font->font = gdk_font_load (fontname);
+       }
+       if (font->font == NULL) {
+          /* Try another platform-font that should be available. (iPaq) */
+-         font->font =
+-            gdk_font_load
+-            ("-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1");
++         sprintf(fontname,"-misc-fixed-medium-r-normal--13-120-75-75-c-80-%s",prefs.font_charset);
++         font->font = gdk_font_load (fontname);
+       }
+       if (font->font == NULL) {
+          /* Can't load any suitable font!  */
+-         g_warning ("Can't load any ISO8859-1 font!?! :(");
+-         font->font =
+-            gdk_font_load ("-adobe-helvetica-*-*-*--*-*-*-*-*-*-*-*");
++         g_warning ("Can't load any font with charset '%s'!?! :(",prefs.font_charset);
++         font->font = gdk_fontset_load("-adobe-helvetica-*-*-*--*-*-*-*-*-*-*-*,-misc-fixed-*,*");
+       }
+    }
+--- dillo-0.7.0~/src/encodings.c       1970-01-01 03:00:00 +0300
++++ dillo-0.7.0/src/encodings.c        2003-02-21 03:15:46 +0300
+@@ -0,0 +1,383 @@
++/* 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 <unistd.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);
++
++extern BrowserWindow **browser_window;
++
++/*
++ * 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");
++   if (access(file, R_OK))
++      Encodings_file_op(LOAD_ENCODINGS, "/etc/dillo/encodings", NULL);
++   else
++   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) {
++         /* SAVE_ENCODINGS is broken anyway, better make use of /etc/dillo/encodings */
++         if ((fp = fopen(title, "r")) == 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;
++}
+--- dillo-0.7.0~/src/encodings.h       1970-01-01 03:00:00 +0300
++++ dillo-0.7.0/src/encodings.h        2003-02-21 03:15:46 +0300
+@@ -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 -ubBdr -N dillo-0.7.0~/src/encodings-types.h dillo-0.7.0/src/encodings-types.h
+--- dillo-0.7.0~/src/encodings-types.h 1970-01-01 03:00:00 +0300
++++ dillo-0.7.0/src/encodings-types.h  2003-02-21 03:15:46 +0300
+@@ -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 -ubBdr -N dillo-0.7.0~/src/html.c dillo-0.7.0/src/html.c
+--- dillo-0.7.0~/src/html.c    2003-02-14 00:01:02 +0300
++++ dillo-0.7.0/src/html.c     2003-02-21 03:15:46 +0300
+@@ -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>
+@@ -48,6 +49,7 @@
+ #include "progressbar.h"
+ #include "prefs.h"
+ #include "misc.h"
++#include "encodings.h"
+ #include "capi.h"
+ #include "html.h"
+@@ -2847,7 +2849,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++) {
+@@ -2911,6 +2913,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);
+@@ -3992,6 +4000,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.
+  * Return value: number of bytes parsed
+@@ -4147,7 +4147,11 @@
+    g_return_if_fail ( (page = DW_PAGE (html->dw)) != NULL );
++   Html_set_encoding(html, buf, bufsize);
++   buf = Html_translate_encoding(html, buf, bufsize);
++
+    token_start = Html_write_raw(html, buf, bufsize, Eof);
++   g_free(buf);
+    html->Start_Ofs += token_start;
+    if ( html->bw ) {
+--- dillo-0.7.0~/src/interface.c       2003-02-11 04:09:59 +0300
++++ dillo-0.7.0/src/interface.c        2003-02-21 03:15:46 +0300
+@@ -19,6 +19,7 @@
+ #include <sys/stat.h>
+ #include <sys/time.h>
+ #include <fcntl.h>
++#include <iconv.h>
+ #include "list.h"
+ #include "misc.h"
+@@ -54,7 +55,7 @@
+  */
+ /* BrowserWindow holds all the widgets (and perhaps more)
+  * for each new_browser.*/
+-static BrowserWindow **browser_window;
++BrowserWindow **browser_window;
+ static gint num_bw, num_bw_max;
+@@ -822,6 +823,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);
+--- dillo-0.7.0~/src/Makefile.am       2003-01-05 22:24:06 +0300
++++ dillo-0.7.0/src/Makefile.am        2003-02-21 03:15:46 +0300
+@@ -57,6 +57,9 @@
+       dw_tooltip.h \
+       dw_widget.c \
+       dw_widget.h \
++      encodings.c \
++      encodings.h \
++      encoding-types.h \
+       findtext.c \
+       findtext.h \
+       web.c   \
+diff -ubBdr -N dillo-0.7.0~/src/Makefile.am.orig dillo-0.7.0/src/Makefile.am.orig
+--- dillo-0.7.0~/src/menu.c    2003-02-11 00:30:13 +0300
++++ dillo-0.7.0/src/menu.c     2003-02-21 03:15:46 +0300
+@@ -33,6 +33,7 @@
+ #include "bookmark.h"
+ #include "interface.h"
+ #include "menu.h"
++#include "encodings.h"
+ /*
+  * Forward declarations
+@@ -124,6 +125,7 @@
+    GtkWidget *file_menu;
+    /* GtkWidget *bookmarks_menu; */
+    /* GtkWidget *help_menu; */
++   GtkWidget *enc_menu;
+    bw->menubar = menubar = gtk_menu_bar_new();
+@@ -160,6 +162,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;
+ }
+--- dillo-0.7.0~/src/prefs.c   2003-02-11 00:40:13 +0300
++++ dillo-0.7.0/src/prefs.c    2003-02-21 03:15:46 +0300
+@@ -51,6 +51,7 @@
+    { "small_icons", DRC_TOKEN_SMALL_ICONS },
+    { "limit_text_width", DRC_TOKEN_LIMIT_TEXT_WIDTH },
+    { "font_factor", DRC_TOKEN_FONT_FACTOR },
++   { "font_charset", DRC_TOKEN_FONT_CHARSET },
+    { "use_dicache", DRC_TOKEN_USE_DICACHE },
+    { "show_back", DRC_TOKEN_SHOW_BACK },
+    { "show_forw", DRC_TOKEN_SHOW_FORW },
+@@ -173,6 +174,10 @@
+    case DRC_TOKEN_FONT_FACTOR:
+       prefs.font_factor = strtod(scanner->value.v_string, NULL);
+       break;
++   case DRC_TOKEN_FONT_CHARSET:
++       if (prefs.font_charset) g_free(prefs.font_charset);
++       prefs.font_charset = g_strdup(scanner->value.v_string);
++      break;
+    case DRC_TOKEN_LIMIT_TEXT_WIDTH:
+       prefs.limit_text_width = (strcmp(scanner->value.v_string, "YES") == 0);
+       break;
+@@ -250,7 +255,7 @@
+    file = a_Misc_prepend_user_home(".dillo/dillorc");
+    fd = open(file, O_RDONLY);
+    g_free(file);
+-   if (fd < 0 && (fd = open("/etc/dillorc", O_RDONLY)) < 0)
++   if (fd < 0 && (fd = open("/etc/dillo/dillorc", O_RDONLY)) < 0)
+       if ((fd = open("/usr/local/etc/dillorc", O_RDONLY)) < 0)
+          return FILE_NOT_FOUND;
+@@ -347,6 +352,7 @@
+    prefs.small_icons = FALSE;
+    prefs.limit_text_width = FALSE;
+    prefs.font_factor = 1.0;
++   prefs.font_charset = g_strdup("iso8859-1");
+    prefs.use_dicache = FALSE;
+    prefs.show_back=TRUE;
+    prefs.show_forw=TRUE;
+@@ -385,6 +391,8 @@
+    g_free(prefs.no_proxy);
+    if (prefs.no_proxy_vec)
+       g_strfreev(prefs.no_proxy_vec);
++   if (prefs.font_charset)
++      g_free (prefs.font_charset);
+    a_Url_free(prefs.http_proxy);
+    g_free(prefs.fw_fontname);
+    g_free(prefs.vw_fontname);
+--- dillo-0.7.0~/src/prefs.h   2003-02-11 00:42:09 +0300
++++ dillo-0.7.0/src/prefs.h    2003-02-21 03:15:45 +0300
+@@ -41,6 +41,7 @@
+    DRC_TOKEN_PANEL_SIZE,
+    DRC_TOKEN_SMALL_ICONS,
+    DRC_TOKEN_FONT_FACTOR,
++   DRC_TOKEN_FONT_CHARSET,
+    DRC_TOKEN_SHOW_TOOLTIP,
+    DRC_TOKEN_LIMIT_TEXT_WIDTH,
+    DRC_TOKEN_USE_DICACHE,
+@@ -87,6 +88,7 @@
+    gboolean small_icons;
+    gboolean limit_text_width;
+    gdouble font_factor;
++   char *font_charset;
+    gboolean use_dicache;
+    gboolean show_back;
+    gboolean show_forw;
This page took 0.080767 seconds and 4 git commands to generate.