summaryrefslogtreecommitdiffstats
path: root/src/recode.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2007-06-27 09:28:22 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2007-06-27 09:28:22 +0000
commit35381569403e90b8d34b223f524519521bc81598 (patch)
tree924527ab503a59400cfd96859e101ce8234eabd0 /src/recode.c
parentfd502754926131e3562a2210ff81af111ccaf867 (diff)
downloadlibrcc-35381569403e90b8d34b223f524519521bc81598.tar.gz
librcc-35381569403e90b8d34b223f524519521bc81598.tar.bz2
librcc-35381569403e90b8d34b223f524519521bc81598.tar.xz
librcc-35381569403e90b8d34b223f524519521bc81598.zip
Engines rework
- LibGuess support for far east language autodetection - Support for LibRCD 0.1.9 supporting ISO-8859-1 strings - Fixing wrong encodings names returned by Enca - Engine plugins naming scheme is altered - New API functions: rccEngineGetInfo, rccEngineGetAutoCharsetByName - Most of languages are no more hardcoded, but moved to the configuration - RCD engine is added to Belarusian language (I hope it should work) - Some encoding names are fixed in configuration - Support for external libiconv - Support for libcharset - Find UI interface language from LC_MESSAGES locale - Simple compilation fix (Thanx to D. Panov)
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) {