* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*
#include <map>
#include <string>
-using std::endl;
-using std::map;
-using std::make_pair;
-using std::string;
-using std::vector;
+using namespace std;
namespace {
struct IconvProcessor::Impl
{
- Impl(std::string const & to, std::string const & from)
+ Impl(string const & to, string const & from)
: cd(invalid_cd), tocode_(to), fromcode_(from)
{}
}
iconv_t cd;
- std::string tocode_;
- std::string fromcode_;
+ string tocode_;
+ string fromcode_;
};
int res = iconv(pimpl_->cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
- //lyxerr << std::dec;
+ // flush out remaining data. This is needed because iconv sometimes
+ // holds back chars in the stream, waiting for a combination character
+ // (see e.g. http://sources.redhat.com/bugzilla/show_bug.cgi?id=1124)
+ iconv(pimpl_->cd, NULL, NULL, &outbuf, &outbytesleft);
+
+ //lyxerr << dec;
//lyxerr << "Inbytesleft: " << inbytesleft << endl;
//lyxerr << "Outbytesleft: " << outbytesleft << endl;
<< " has been encountered in the input.\n"
<< "When converting from " << pimpl_->fromcode_
<< " to " << pimpl_->tocode_ << ".\n";
- lyxerr << "Input:" << std::hex;
+ lyxerr << "Input:" << hex;
for (size_t i = 0; i < buflen; ++i) {
// char may be signed, avoid output of
// something like 0xffffffc2
*reinterpret_cast<unsigned char const *>(buf + i);
lyxerr << " 0x" << (unsigned int)b;
}
- lyxerr << std::dec << endl;
+ lyxerr << dec << endl;
break;
case EINVAL:
lyxerr << "EINVAL An incomplete multibyte sequence"
<< " has been encountered in the input.\n"
<< "When converting from " << pimpl_->fromcode_
<< " to " << pimpl_->tocode_ << ".\n";
- lyxerr << "Input:" << std::hex;
+ lyxerr << "Input:" << hex;
for (size_t i = 0; i < buflen; ++i) {
// char may be signed, avoid output of
// something like 0xffffffc2
*reinterpret_cast<unsigned char const *>(buf + i);
lyxerr << " 0x" << (unsigned int)b;
}
- lyxerr << std::dec << endl;
+ lyxerr << dec << endl;
break;
default:
lyxerr << "\tSome other error: " << errno << endl;