Amiga: Use IANA codeset number to identify local charset

This commit is contained in:
Chris Young 2020-05-26 15:08:51 +01:00
parent 22ea4cbe65
commit 68f1b41bf0
3 changed files with 19 additions and 6 deletions

View File

@ -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);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2008 - 2012 Chris Young <chris@unsatisfactorysoftware.co.uk>
* Copyright 2008 - 2020 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* 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

View File

@ -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);