X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fdocstream.C;h=cec49561563f1af43fbc43c7effea12e01c9b883;hb=6bfb3e6dc47ae7caa0565607e52a34104ea4ac19;hp=525f3673e0a9fa7e2fd43a9d149d99976f0c2951;hpb=095625dc3cd0542d13d8cc62362aa71c896eb3e0;p=lyx.git diff --git a/src/support/docstream.C b/src/support/docstream.C index 525f3673e0..cec4956156 100644 --- a/src/support/docstream.C +++ b/src/support/docstream.C @@ -26,8 +26,6 @@ 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. @@ -199,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); }