summaryrefslogtreecommitdiffstats
path: root/src/recode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recode.c')
-rw-r--r--src/recode.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/recode.c b/src/recode.c
index e1e8e81..1d98306 100644
--- a/src/recode.c
+++ b/src/recode.c
@@ -742,7 +742,12 @@ rcc_string rccSizedFromCharset(rcc_context ctx, const char *charset, const char
rcc_string ret;
if ((!buf)||(!charset)) return NULL;
-
+
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
+
config = rccGetCurrentConfig(ctx);
if (!config) return NULL;
@@ -768,6 +773,11 @@ char *rccSizedToCharset(rcc_context ctx, const char *charset, rcc_const_string b
if ((!buf)||(!charset)) return NULL;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
+
res = rccStringCheck(buf);
if (!res) return NULL;
@@ -799,6 +809,11 @@ char *rccSizedRecodeToCharset(rcc_context ctx, rcc_class_id class_id, const char
char *utf8, *extracted;
if (!charset) return NULL;
+
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
utf8 = rccSizedFrom(ctx, class_id, buf, len);
if (!utf8) return utf8;
@@ -839,6 +854,11 @@ char *rccSizedRecodeFromCharset(rcc_context ctx, rcc_class_id class_id, const ch
char *extracted;
if (!charset) return NULL;
+
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return NULL;
+ }
icnv = rccIConvOpen("UTF-8", charset);
if (icnv) {