From 7051b9e563f7cdf5e09e65a33b5ac0152061e541 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 25 Jun 2016 21:24:45 +0100 Subject: Use libiconv instead of newlib's iconv Requires invalid input to be explicitly ignored, as unlike newlib invalid characters are not replaced with '?' Fixes bug 2440 --- frontends/amiga/utf8.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'frontends/amiga/utf8.c') diff --git a/frontends/amiga/utf8.c b/frontends/amiga/utf8.c index d48e073fd..5d05e9535 100755 --- a/frontends/amiga/utf8.c +++ b/frontends/amiga/utf8.c @@ -16,10 +16,15 @@ * along with this program. If not, see . */ +#include "amiga/os3support.h" + #include #include #include +#include +#include + #include "utils/nsoption.h" #include "utils/utf8.h" #include "netsurf/utf8.h" @@ -33,7 +38,13 @@ nserror utf8_from_local_encoding(const char *string, size_t len, char **result) nserror utf8_to_local_encoding(const char *string, size_t len, char **result) { - return utf8_to_enc(string, nsoption_charp(local_charset), len, 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); + } + return err; } void ami_utf8_free(char *ptr) @@ -44,7 +55,6 @@ void ami_utf8_free(char *ptr) char *ami_utf8_easy(const char *string) { char *localtext; - if(utf8_to_local_encoding(string, strlen(string), &localtext) == NSERROR_OK) { return localtext; } else { -- cgit v1.2.3