aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/charConv.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/charConv.c b/src/charConv.c
index 05c03167e..4e4aa864a 100644
--- a/src/charConv.c
+++ b/src/charConv.c
@@ -45,10 +45,19 @@ static void closeCharSetConversion();
int setCharSetConversion(char *to, char *from)
{
- if (char_conv_to && char_conv_from &&
- strcmp(to, char_conv_to) == 0 && strcmp(from, char_conv_from) == 0)
- {
- return 0;
+ if (char_conv_to && char_conv_from) {
+ if (char_conv_latin1ToUtf8 &&
+ !strcmp(from, char_conv_to) &&
+ !strcmp(to, char_conv_from)) {
+ char *swap = char_conv_from;
+ char_conv_from = char_conv_to;
+ char_conv_to = swap;
+ char_conv_latin1ToUtf8 *= -1;
+ return 0;
+ } else if (!strcmp(to, char_conv_to) &&
+ !strcmp(from,char_conv_from)) {
+ return 0;
+ }
}
closeCharSetConversion();