summaryrefslogtreecommitdiff
path: root/lingucomponent/source/lingutil
diff options
context:
space:
mode:
authorThomas Lange [tl] <tl@openoffice.org>2010-07-21 16:29:56 +0200
committerThomas Lange [tl] <tl@openoffice.org>2010-07-21 16:29:56 +0200
commitc7896e24ec34b87aba39e8b2ff19a21fe0c518a6 (patch)
tree92be29fc60478d6b727ce86211983f3baa773b8a /lingucomponent/source/lingutil
parent16ae4c1524769458f6d205430e7dcb8fc4ae333b (diff)
cws tl82: #i113293# unify encoding detection for linguistic components
Diffstat (limited to 'lingucomponent/source/lingutil')
-rwxr-xr-x[-rw-r--r--]lingucomponent/source/lingutil/lingutil.cxx21
-rw-r--r--lingucomponent/source/lingutil/lingutil.hxx8
2 files changed, 29 insertions, 0 deletions
diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index ee7d71de4435..14253fca5cd3 100644..100755
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -50,6 +50,7 @@
#include <unotools/pathoptions.hxx>
#include <rtl/ustring.hxx>
#include <rtl/string.hxx>
+#include <rtl/tencinfo.h>
#include <linguistic/misc.hxx>
#include <set>
@@ -268,5 +269,25 @@ void MergeNewStyleDicsAndOldStyleDics(
}
}
+
+rtl_TextEncoding getTextEncodingFromCharset(const sal_Char* pCharset)
+{
+ // default result: used to indicate that we failed to get the proper encoding
+ rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW;
+
+ if (pCharset)
+ {
+ eRet = rtl_getTextEncodingFromMimeCharset(pCharset);
+ if (eRet == RTL_TEXTENCODING_DONTKNOW)
+ eRet = rtl_getTextEncodingFromUnixCharset(pCharset);
+ if (eRet == RTL_TEXTENCODING_DONTKNOW)
+ {
+ if (strcmp("ISCII-DEVANAGARI", pCharset) == 0)
+ eRet = RTL_TEXTENCODING_ISCII_DEVANAGARI;
+ }
+ }
+ return eRet;
+}
+
//////////////////////////////////////////////////////////////////////
diff --git a/lingucomponent/source/lingutil/lingutil.hxx b/lingucomponent/source/lingutil/lingutil.hxx
index 8b45b1f509ad..82d2e646edfc 100644
--- a/lingucomponent/source/lingutil/lingutil.hxx
+++ b/lingucomponent/source/lingutil/lingutil.hxx
@@ -101,5 +101,13 @@ void MergeNewStyleDicsAndOldStyleDics( std::list< SvtLinguConfigDictionaryEntry
///////////////////////////////////////////////////////////////////////////
+
+//Find an encoding from a charset string, using
+//rtl_getTextEncodingFromMimeCharset and falling back to
+//rtl_getTextEncodingFromUnixCharset with the addition of
+//ISCII-DEVANAGARI. On failure will return final fallback of
+//RTL_TEXTENCODING_ISO_8859_1
+rtl_TextEncoding getTextEncodingFromCharset(const sal_Char* pCharset);
+
#endif