summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31034b9)
raw | patch | inline | side by side (parent: 31034b9)
author | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Mon, 14 Nov 2011 10:18:36 +0000 (10:18 +0000) | ||
committer | Gert van Valkenhoef <g.h.m.van.valkenhoef@rug.nl> | |
Mon, 14 Nov 2011 10:18:36 +0000 (10:18 +0000) |
odcread.cc | patch | blob | history |
diff --git a/odcread.cc b/odcread.cc
index fc210a8a10c59f5cc0e0660a711a702114b2bc9e..891ea990102ba11cd63da7e952d66b4c2a3c379f 100644 (file)
--- a/odcread.cc
+++ b/odcread.cc
#include <visitor.h>
// Character encoding conversions
-#include <locale.h>
-#include <iconv.h>
-#include <errno.h>
-#include <string.h>
+#include <langinfo.h> // determine the current charset
+#include <locale.h> // locale support
+#include <iconv.h> // charset conversions
+#include <errno.h> // error codes
+#include <string.h> // string descriptions of error codes
namespace odc {
class Context {
terminateContext();
}
char *getCharSet() {
- return "UTF-8"; // FIXME setlocale(LC_CTYPE, 0) + processing
+ return nl_langinfo(CODESET);
}
virtual void textShortPiece(const ShortPiece *piece) {
- iconv_t conv = iconv_open("UTF-8", "ISO-8859-1");
+ iconv_t conv = iconv_open(getCharSet(), "ISO-8859-1");
if (conv == (iconv_t)-1) {
std::string str("iconv initialization error: ");
str += strerror(errno);
d_context.top()->addPiece(str);
*/
//d_convLong = iconv_open(setlocale(LC_CTYPE, 0), "UCS-2");
- iconv_t conv = iconv_open("UTF-8", "UCS-2");
+ iconv_t conv = iconv_open(getCharSet(), "UCS-2");
if (conv == (iconv_t)-1) {
std::string str("iconv initialization error: ");
str += strerror(errno);