From 1985106c2eefbbc3d40398f759de6be1d690315e Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 3 Dec 2019 16:48:08 -0300 Subject: [PATCH] Fixing iconv wrapper. --- src/core/charset/iconv.c | 5 +++-- src/testprogram/testprogram.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/core/charset/iconv.c b/src/core/charset/iconv.c index 9fd1ff2..f6a1b97 100644 --- a/src/core/charset/iconv.c +++ b/src/core/charset/iconv.c @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -112,10 +113,10 @@ struct _lib3270_iconv char * lib3270_iconv_from_host(LIB3270_ICONV *conv, const char *str, int len) { - return convert(&conv->local,str,len); + return convert(conv->local,str,len); } char * lib3270_iconv_to_host(LIB3270_ICONV *conv, const char *str, int len) { - return convert(&conv->host,str,len); + return convert(conv->host,str,len); } diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 01563a8..47f1648 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -11,6 +11,7 @@ #include #include #include +#include #define MAX_ARGS 10 @@ -34,6 +35,16 @@ static void online_group_state_changed(H3270 GNUC_UNUSED(*hSession), void GNUC_U int main(int argc, char *argv[]) { + + { + LIB3270_ICONV *converter = lib3270_iconv_new("iso-8859-1","utf-8"); + + lib3270_autoptr(char) text = lib3270_iconv_to_host(converter,"teste",-1); + + lib3270_iconv_free(converter); + return 0; + } + // #pragma GCC diagnostic push // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" static struct option options[] = { -- libgit2 0.21.2