summaryrefslogtreecommitdiffstats
path: root/examples/example2.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example2.c')
-rw-r--r--examples/example2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/example2.c b/examples/example2.c
index 13c280e..f8b085c 100644
--- a/examples/example2.c
+++ b/examples/example2.c
@@ -65,14 +65,17 @@ int main(int argc, char *argv[]) {
if (strlen(buf)<2) break;
rccstring = rccFrom(NULL, 0, buf);
+ if (!rccstring) rccstring = strdup(buf);
+
if (rccstring) {
recoded = rccTo(NULL, 1, rccstring);
+ if (!recoded) recoded = strdup(rccstring);
if (recoded) {
printf("%s", recoded);
free(recoded);
- } else printf("Recoding from UTF-8 is failed\n");
+ }
free(rccstring);
- } else printf("Recoding to UTF-8 is failed\n");
+ }
}
rccFree();