Default charset patch (bug 0000068)

Rune Saetre <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi

Here is a patch for setting a default charset if none is indicated in the
http reply. Id is fixed as indicated in bug report 0000068.

  http://bugs.kannel.org/view_bug_advanced_page.php?f_id=0000068

It seems to be required to see pages using international characters
where the charset is not indicated by the server.
There are a lot of these here in Norway.

This works for me, and I have not found any ill effects (yet).

By the way, the configure-script fails to set the variable TEX_DSL on my
Debian 3.1-system. I think it should finally resolve to this:

   /usr/share/sgml/docbook/stylesheet/dsssl/modular/print/docbook.dsl

Instead it fails silently, and the building of the documentation fails.

Regards
Rune

---
Rune Sætre <[email protected]>
NetCom as
..
kannel140_charset.patch (text/plain, 1.1 KB)
diff -uprN clean/gateway-1.4.0/gwlib/http.c fixed/gateway-1.4.0/gwlib/http.c
--- clean/gateway-1.4.0/gwlib/http.c    2004-08-11 18:41:29.000000000 +0200
+++ fixed/gateway-1.4.0/gwlib/http.c    2004-12-04 06:32:51.000000000 +0100
@@ -2928,15 +2928,16 @@ void http_header_get_content_type(List *
         semicolon = octstr_search_char(h, ';', 0);
         if (semicolon == -1) {
             *type = h;
-            *charset = octstr_create("");
+            *charset = octstr_create("ISO-8859-1");
         } else {
             *charset = octstr_duplicate(h);
             octstr_delete(*charset, 0, semicolon + 1);
             octstr_strip_blanks(*charset);
             equals = octstr_search_char(*charset, '=', 0);
-            if (equals == -1)
-                octstr_truncate(*charset, 0);
-            else {
+            if (equals == -1) {
+                octstr_destroy(*charset);
+                *charset = octstr_create("ISO-8859-1");
+            } else {
                 octstr_delete(*charset, 0, equals + 1);
                 if (octstr_get_char(*charset, 0) == '"')
                     octstr_delete(*charset, 0, 1);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.