X-Git-Url: https://deadsoftware.ru/gitweb?p=odcread.git;a=blobdiff_plain;f=odcread.cc;h=891ea990102ba11cd63da7e952d66b4c2a3c379f;hp=fc210a8a10c59f5cc0e0660a711a702114b2bc9e;hb=20613bcf69e139c028704661ad16536217f10990;hpb=31034b9704565140db20590413300b950bfead83 diff --git a/odcread.cc b/odcread.cc index fc210a8..891ea99 100644 --- a/odcread.cc +++ b/odcread.cc @@ -10,10 +10,11 @@ #include // Character encoding conversions -#include -#include -#include -#include +#include // determine the current charset +#include // locale support +#include // charset conversions +#include // error codes +#include // string descriptions of error codes namespace odc { class Context { @@ -87,10 +88,10 @@ namespace odc { 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); @@ -121,7 +122,7 @@ namespace odc { 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);