diff --git a/src/lt.c b/src/lt.c index bbd5d7f..edddd4a 100644 --- a/src/lt.c +++ b/src/lt.c @@ -81,8 +81,18 @@ void LT_Init(LT_InitInfo initInfo) { info = initInfo; - if(info.doConvert) + if(info.doConvert && info.fromCode != NULL && info.toCode != NULL) { + if(strcmp(info.fromCode, "UTF8")) + { + info.fromCode = "UTF-8"; + } + + if(strcmp(info.toCode, "UTF8")) + { + info.toCode = "UTF-8"; + } + icDesc = iconv_open(info.toCode, info.fromCode); if(icDesc == (iconv_t) -1) @@ -90,6 +100,15 @@ void LT_Init(LT_InitInfo initInfo) LT_Assert(true, "LT_Init: Failure opening iconv"); } } + else + { + info.doConvert = false; + } + + if(info.stripInvalid && info.doConvert) + { + info.stripInvalid = false; + } gbHead = malloc(sizeof(LT_GarbageList)); gbHead->next = NULL;