Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/68f1b41bf0c62b79a95c4547194bf7bde535de47
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/68f1b41bf0c62b79a95c4547194bf7bde535de47
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/68f1b41bf0c62b79a95c4547194bf7bde535de47

The branch, master has been updated
       via  68f1b41bf0c62b79a95c4547194bf7bde535de47 (commit)
       via  22ea4cbe65b5bf737269dd0deeccb0cdf0124387 (commit)
      from  85dea6eed305f0e02a807e1722c06b54f5c31488 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=68f1b41bf0c62b79a95c4547194bf7bde535de47
commit 68f1b41bf0c62b79a95c4547194bf7bde535de47
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Amiga: Use IANA codeset number to identify local charset

diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 36ee756..8eb34fb 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1095,6 +1095,7 @@ static nserror ami_set_options(struct nsoption_s 
*defaults)
        const char *encname = (const char *)ObtainCharsetInfo(DFCS_NUMBER, 
codeset,
                                                        DFCS_MIMENAME);
        nsoption_set_charp(local_charset, strdup(encname));
+       nsoption_set_int(local_codeset, codeset);
 #else
        nsoption_set_bool(download_notify, false);
        nsoption_set_bool(font_antialiasing, false);
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index 196b057..101558f 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 - 2012 Chris Young <[email protected]>
+ * Copyright 2008 - 2020 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -89,12 +89,22 @@ NSOPTION_INTEGER(redraw_tile_size_y, 0)
 NSOPTION_INTEGER(monitor_aspect_x, 0)
 NSOPTION_INTEGER(monitor_aspect_y, 0)
 NSOPTION_BOOL(accept_lang_locale, true)
+
+/* Local charset when using iconv */
 NSOPTION_STRING(local_charset, "ISO-8859-1")
+
 #ifdef __amigaos4__
-/* Options relevant for OS4 only */
+/** Options relevant for OS4 only **/
+
+/* Local charset IANA number when using codesets */
+NSOPTION_INTEGER(local_codeset, 0)
+
+/* Use ExtMem */
 NSOPTION_BOOL(use_extmem, true)
+
 #else
-/* Options relevant for OS3 only */
+/** Options relevant for OS3 only **/
+
 NSOPTION_BOOL(friend_bitmap, false)
 #endif
 
diff --git a/frontends/amiga/utf8.c b/frontends/amiga/utf8.c
index 83872eb..f16cbba 100755
--- a/frontends/amiga/utf8.c
+++ b/frontends/amiga/utf8.c
@@ -38,16 +38,18 @@ static nserror ami_utf8_codesets(const char *string, size_t 
len, char **result,
        ULONG utf8_tag, local_tag;
 
        if(to_local == false) {
-               local_tag = CSA_SourceCodeset;
+               local_tag = CSA_SourceMIBenum;
                utf8_tag = CSA_DestMIBenum;
        } else {
                utf8_tag = CSA_SourceMIBenum;
-               local_tag = CSA_DestCodeset;
+               local_tag = CSA_DestMIBenum;
        }
 
        out = CodesetsConvertStr(CSA_Source, string,
                                                CSA_SourceLen, len,
-                                               local_tag, 
CodesetsFindA(nsoption_charp(local_charset), NULL),
+#ifdef __amigaos4__
+                                               local_tag, 
nsoption_int(local_codeset),
+#endif
                                                utf8_tag, CS_MIBENUM_UTF_8,
                                                CSA_MapForeignChars, TRUE,
                                                TAG_DONE);


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=22ea4cbe65b5bf737269dd0deeccb0cdf0124387
commit 22ea4cbe65b5bf737269dd0deeccb0cdf0124387
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Amiga: Use codesets.library for UTF8 conversion if available

diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c
index 109baa4..3c09bcb 100644
--- a/frontends/amiga/libs.c
+++ b/frontends/amiga/libs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Chris Young <[email protected]>
+ * Copyright 2014-2020 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -189,6 +189,7 @@ AMINS_LIB_STRUCT(Locale);
 AMINS_LIB_STRUCT(P96);
 AMINS_LIB_STRUCT(Workbench);
 
+AMINS_LIB_STRUCT(Codesets);
 AMINS_LIB_STRUCT(GuiGFX);
 
 AMINS_CLASS_STRUCT(ARexx);
@@ -248,7 +249,8 @@ bool ami_libs_open(void)
                AMINS_LIB_OPEN("Picasso96API.library",  0, P96,         "main", 
       1, false)
 
        /* Non-OS provided libraries */
-       AMINS_LIB_OPEN("guigfx.library",    9, GuiGFX,   "main",        1, 
false)
+       AMINS_LIB_OPEN("codesets.library",    6, Codesets,   "main",        1, 
false)
+       AMINS_LIB_OPEN("guigfx.library",      9, GuiGFX,     "main",        1, 
false)
 
        /* NB: timer.device is opened in schedule.c (ultimately by the 
scheduler process).
         * The library base and interface are obtained there, rather than here, 
due to
@@ -324,6 +326,7 @@ void ami_libs_close(void)
        AMINS_CLASS_CLOSE(Window)
 
        /* Libraries */
+       AMINS_LIB_CLOSE(Codesets)
        AMINS_LIB_CLOSE(GuiGFX)
 
        AMINS_LIB_CLOSE(Asl)
diff --git a/frontends/amiga/utf8.c b/frontends/amiga/utf8.c
index 5d05e95..83872eb 100755
--- a/frontends/amiga/utf8.c
+++ b/frontends/amiga/utf8.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Chris Young <[email protected]>
+ * Copyright 2008-2020 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include <proto/codesets.h>
 #include <proto/exec.h>
 #include <proto/utility.h>
 
@@ -31,20 +32,58 @@
 
 #include "amiga/utf8.h"
 
+static nserror ami_utf8_codesets(const char *string, size_t len, char 
**result, bool to_local)
+{
+       char *out;
+       ULONG utf8_tag, local_tag;
+
+       if(to_local == false) {
+               local_tag = CSA_SourceCodeset;
+               utf8_tag = CSA_DestMIBenum;
+       } else {
+               utf8_tag = CSA_SourceMIBenum;
+               local_tag = CSA_DestCodeset;
+       }
+
+       out = CodesetsConvertStr(CSA_Source, string,
+                                               CSA_SourceLen, len,
+                                               local_tag, 
CodesetsFindA(nsoption_charp(local_charset), NULL),
+                                               utf8_tag, CS_MIBENUM_UTF_8,
+                                               CSA_MapForeignChars, TRUE,
+                                               TAG_DONE);
+
+       if(out != NULL) {
+               *result = strdup(out);
+               CodesetsFreeA(out, NULL);
+       } else {
+               return NSERROR_BAD_ENCODING;
+       }
+
+       return NSERROR_OK;
+}
+
 nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
 {
-       return utf8_from_enc(string, nsoption_charp(local_charset), len, 
result, NULL);
+       if(__builtin_expect((CodesetsBase == NULL), 0)) {
+               return utf8_from_enc(string, nsoption_charp(local_charset), 
len, result, NULL);
+       } else {
+               return ami_utf8_codesets(string, len, result, false);
+       }
 }
 
 nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
 {
-       nserror err = NSERROR_NOMEM;
-       char *local_charset = ASPrintf("%s//IGNORE", 
nsoption_charp(local_charset));
-       if(local_charset) {
-               err = utf8_to_enc(string, local_charset, len, result);
-               FreeVec(local_charset);
+       if(__builtin_expect((CodesetsBase == NULL), 0)) {
+               nserror err = NSERROR_NOMEM;
+               char *local_charset = ASPrintf("%s//IGNORE", 
nsoption_charp(local_charset));
+               if(local_charset) {
+                       err = utf8_to_enc(string, local_charset, len, result);
+                       FreeVec(local_charset);
+               }
+               return err;
+       } else {
+               return ami_utf8_codesets(string, len, result, true);
        }
-       return err;
 }
 
 void ami_utf8_free(char *ptr)


-----------------------------------------------------------------------

Summary of changes:
 frontends/amiga/gui.c     |    1 +
 frontends/amiga/libs.c    |    7 ++++--
 frontends/amiga/options.h |   16 ++++++++++---
 frontends/amiga/utf8.c    |   57 ++++++++++++++++++++++++++++++++++++++-------
 4 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 36ee756..8eb34fb 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -1095,6 +1095,7 @@ static nserror ami_set_options(struct nsoption_s 
*defaults)
        const char *encname = (const char *)ObtainCharsetInfo(DFCS_NUMBER, 
codeset,
                                                        DFCS_MIMENAME);
        nsoption_set_charp(local_charset, strdup(encname));
+       nsoption_set_int(local_codeset, codeset);
 #else
        nsoption_set_bool(download_notify, false);
        nsoption_set_bool(font_antialiasing, false);
diff --git a/frontends/amiga/libs.c b/frontends/amiga/libs.c
index 109baa4..3c09bcb 100644
--- a/frontends/amiga/libs.c
+++ b/frontends/amiga/libs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Chris Young <[email protected]>
+ * Copyright 2014-2020 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -189,6 +189,7 @@ AMINS_LIB_STRUCT(Locale);
 AMINS_LIB_STRUCT(P96);
 AMINS_LIB_STRUCT(Workbench);
 
+AMINS_LIB_STRUCT(Codesets);
 AMINS_LIB_STRUCT(GuiGFX);
 
 AMINS_CLASS_STRUCT(ARexx);
@@ -248,7 +249,8 @@ bool ami_libs_open(void)
                AMINS_LIB_OPEN("Picasso96API.library",  0, P96,         "main", 
       1, false)
 
        /* Non-OS provided libraries */
-       AMINS_LIB_OPEN("guigfx.library",    9, GuiGFX,   "main",        1, 
false)
+       AMINS_LIB_OPEN("codesets.library",    6, Codesets,   "main",        1, 
false)
+       AMINS_LIB_OPEN("guigfx.library",      9, GuiGFX,     "main",        1, 
false)
 
        /* NB: timer.device is opened in schedule.c (ultimately by the 
scheduler process).
         * The library base and interface are obtained there, rather than here, 
due to
@@ -324,6 +326,7 @@ void ami_libs_close(void)
        AMINS_CLASS_CLOSE(Window)
 
        /* Libraries */
+       AMINS_LIB_CLOSE(Codesets)
        AMINS_LIB_CLOSE(GuiGFX)
 
        AMINS_LIB_CLOSE(Asl)
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index 196b057..101558f 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 - 2012 Chris Young <[email protected]>
+ * Copyright 2008 - 2020 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -89,12 +89,22 @@ NSOPTION_INTEGER(redraw_tile_size_y, 0)
 NSOPTION_INTEGER(monitor_aspect_x, 0)
 NSOPTION_INTEGER(monitor_aspect_y, 0)
 NSOPTION_BOOL(accept_lang_locale, true)
+
+/* Local charset when using iconv */
 NSOPTION_STRING(local_charset, "ISO-8859-1")
+
 #ifdef __amigaos4__
-/* Options relevant for OS4 only */
+/** Options relevant for OS4 only **/
+
+/* Local charset IANA number when using codesets */
+NSOPTION_INTEGER(local_codeset, 0)
+
+/* Use ExtMem */
 NSOPTION_BOOL(use_extmem, true)
+
 #else
-/* Options relevant for OS3 only */
+/** Options relevant for OS3 only **/
+
 NSOPTION_BOOL(friend_bitmap, false)
 #endif
 
diff --git a/frontends/amiga/utf8.c b/frontends/amiga/utf8.c
index 5d05e95..f16cbba 100755
--- a/frontends/amiga/utf8.c
+++ b/frontends/amiga/utf8.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Chris Young <[email protected]>
+ * Copyright 2008-2020 Chris Young <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <sys/types.h>
 
+#include <proto/codesets.h>
 #include <proto/exec.h>
 #include <proto/utility.h>
 
@@ -31,20 +32,60 @@
 
 #include "amiga/utf8.h"
 
+static nserror ami_utf8_codesets(const char *string, size_t len, char 
**result, bool to_local)
+{
+       char *out;
+       ULONG utf8_tag, local_tag;
+
+       if(to_local == false) {
+               local_tag = CSA_SourceMIBenum;
+               utf8_tag = CSA_DestMIBenum;
+       } else {
+               utf8_tag = CSA_SourceMIBenum;
+               local_tag = CSA_DestMIBenum;
+       }
+
+       out = CodesetsConvertStr(CSA_Source, string,
+                                               CSA_SourceLen, len,
+#ifdef __amigaos4__
+                                               local_tag, 
nsoption_int(local_codeset),
+#endif
+                                               utf8_tag, CS_MIBENUM_UTF_8,
+                                               CSA_MapForeignChars, TRUE,
+                                               TAG_DONE);
+
+       if(out != NULL) {
+               *result = strdup(out);
+               CodesetsFreeA(out, NULL);
+       } else {
+               return NSERROR_BAD_ENCODING;
+       }
+
+       return NSERROR_OK;
+}
+
 nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
 {
-       return utf8_from_enc(string, nsoption_charp(local_charset), len, 
result, NULL);
+       if(__builtin_expect((CodesetsBase == NULL), 0)) {
+               return utf8_from_enc(string, nsoption_charp(local_charset), 
len, result, NULL);
+       } else {
+               return ami_utf8_codesets(string, len, result, false);
+       }
 }
 
 nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
 {
-       nserror err = NSERROR_NOMEM;
-       char *local_charset = ASPrintf("%s//IGNORE", 
nsoption_charp(local_charset));
-       if(local_charset) {
-               err = utf8_to_enc(string, local_charset, len, result);
-               FreeVec(local_charset);
+       if(__builtin_expect((CodesetsBase == NULL), 0)) {
+               nserror err = NSERROR_NOMEM;
+               char *local_charset = ASPrintf("%s//IGNORE", 
nsoption_charp(local_charset));
+               if(local_charset) {
+                       err = utf8_to_enc(string, local_charset, len, result);
+                       FreeVec(local_charset);
+               }
+               return err;
+       } else {
+               return ami_utf8_codesets(string, len, result, true);
        }
-       return err;
 }
 
 void ami_utf8_free(char *ptr)


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to