From 14bf4b47a5ea36ba329e5910f3aa1d26cc452be9 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 25 Jun 2016 17:52:32 +0100 Subject: Use charset from default Locale and store it in an option so we can (a) override and (b) get it without constantly looking it up --- frontends/amiga/gui.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'frontends/amiga/gui.c') diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c index ac173eb1e..8d7c69ddb 100644 --- a/frontends/amiga/gui.c +++ b/frontends/amiga/gui.c @@ -28,6 +28,7 @@ #endif #include #include +#include #include #include #include @@ -44,6 +45,7 @@ #include #include #ifdef __amigaos4__ +#include #include #include #include @@ -247,7 +249,7 @@ static void gui_window_place_caret(struct gui_window *g, int x, int y, int heigh -STRPTR ami_locale_langs(void) +STRPTR ami_locale_langs(int *codeset) { struct Locale *locale; STRPTR acceptlangs = NULL; @@ -255,6 +257,8 @@ STRPTR ami_locale_langs(void) if((locale = OpenLocale(NULL))) { + if(codeset != NULL) *codeset = locale->loc_CodeSet; + for(int i = 0; i < 10; i++) { if(locale->loc_PrefLanguages[i]) @@ -562,6 +566,7 @@ static nserror ami_set_options(struct nsoption_s *defaults) { STRPTR tempacceptlangs; char temp[1024]; + int codeset = 0; /* The following line disables the popupmenu.class select menu. ** It's not recommended to use it! @@ -572,20 +577,11 @@ static nserror ami_set_options(struct nsoption_s *defaults) if(ClickTabBase->lib_Version < 53) nsoption_set_bool(tab_always_show, true); - /* Some AmigaOS3 overrides */ -#ifndef __amigaos4__ - nsoption_set_bool(download_notify, false); - nsoption_set_bool(font_antialiasing, false); - nsoption_set_bool(truecolour_mouse_pointers, false); - nsoption_set_bool(use_openurl_lib, true); - nsoption_set_bool(bitmap_fonts, true); -#endif - if((!nsoption_charp(accept_language)) || (nsoption_charp(accept_language)[0] == '\0') || (nsoption_bool(accept_lang_locale) == true)) { - if((tempacceptlangs = ami_locale_langs())) + if((tempacceptlangs = ami_locale_langs(&codeset))) { nsoption_set_charp(accept_language, (char *)strdup(tempacceptlangs)); @@ -593,6 +589,20 @@ static nserror ami_set_options(struct nsoption_s *defaults) } } + /* Some OS-specific overrides */ +#ifdef __amigaos4__ + if(codeset == 0) codeset = 4; /* ISO-8859-1 */ + const char *encname = (const char *)ObtainCharsetInfo(DFCS_NUMBER, codeset, + DFCS_MIMENAME); + nsoption_set_charp(local_charset, strdup(encname)); +#else + nsoption_set_bool(download_notify, false); + nsoption_set_bool(font_antialiasing, false); + nsoption_set_bool(truecolour_mouse_pointers, false); + nsoption_set_bool(use_openurl_lib, true); + nsoption_set_bool(bitmap_fonts, true); +#endif + sprintf(temp, "%s/Cookies", current_user_dir); nsoption_setnull_charp(cookie_file, (char *)strdup(temp)); -- cgit v1.2.3