X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fdocstream.C;h=cec49561563f1af43fbc43c7effea12e01c9b883;hb=6bfb3e6dc47ae7caa0565607e52a34104ea4ac19;hp=4347d6ba5b345b8520ece846e475cc6288d23d09;hpb=864ed2c8f98b8260b5a07f2d0f002930c9e38ac3;p=lyx.git diff --git a/src/support/docstream.C b/src/support/docstream.C index 4347d6ba5b..cec4956156 100644 --- a/src/support/docstream.C +++ b/src/support/docstream.C @@ -20,15 +20,12 @@ using lyx::ucs4_codeset; -using lyx::ucs2_codeset; using std::string; namespace { -char const * utf8_codeset = "UTF-8"; - // We use C IO throughout this file, because the facets might be used with // lyxerr in the future. @@ -200,20 +197,21 @@ const char * iconv_codecvt_facet_exception::what() const throw() } -idocfstream::idocfstream() : base() +idocfstream::idocfstream(string const & encoding) : base() { std::locale global; - std::locale locale(global, new iconv_codecvt_facet(utf8_codeset, in)); + std::locale locale(global, new iconv_codecvt_facet(encoding, in)); imbue(locale); } -idocfstream::idocfstream(const char* s, std::ios_base::openmode mode) +idocfstream::idocfstream(const char* s, std::ios_base::openmode mode, + string const & encoding) : base() { // We must imbue the stream before openening the file std::locale global; - std::locale locale(global, new iconv_codecvt_facet(utf8_codeset, in)); + std::locale locale(global, new iconv_codecvt_facet(encoding, in)); imbue(locale); open(s, mode); }