mh_execm: send/receive charset-related parms (no filter use them for now)

This commit is contained in:
Jean-Francois Dockes 2011-02-01 19:16:32 +01:00
parent 57d9d2439c
commit 93a761785a

View File

@ -169,6 +169,10 @@ bool MimeHandlerExecMultiple::next_document()
if (m_ipath.length()) { if (m_ipath.length()) {
obuf << "Ipath: " << m_ipath.length() << "\n" << m_ipath; obuf << "Ipath: " << m_ipath.length() << "\n" << m_ipath;
} }
if (!m_dfltInputCharset.empty()) {
obuf << "DflInCS: " << m_dfltInputCharset.length() << "\n"
<< m_dfltInputCharset;
}
obuf << "Mimetype: " << m_mimeType.length() << "\n" << m_mimeType; obuf << "Mimetype: " << m_mimeType.length() << "\n" << m_mimeType;
obuf << "\n"; obuf << "\n";
if (m_cmd.send(obuf.str()) < 0) { if (m_cmd.send(obuf.str()) < 0) {
@ -185,6 +189,7 @@ bool MimeHandlerExecMultiple::next_document()
bool subdocerror_received = false; bool subdocerror_received = false;
string ipath; string ipath;
string mtype; string mtype;
string charset;
for (int loop=0;;loop++) { for (int loop=0;;loop++) {
string name, data; string name, data;
if (!readDataElement(name, data)) { if (!readDataElement(name, data)) {
@ -208,6 +213,9 @@ bool MimeHandlerExecMultiple::next_document()
} else if (!stringlowercmp("ipath:", name)) { } else if (!stringlowercmp("ipath:", name)) {
ipath = data; ipath = data;
LOGDEB(("MHExecMultiple: got ipath [%s]\n", data.c_str())); LOGDEB(("MHExecMultiple: got ipath [%s]\n", data.c_str()));
} else if (!stringlowercmp("charset:", name)) {
charset = data;
LOGDEB(("MHExecMultiple: got ipath [%s]\n", data.c_str()));
} else if (!stringlowercmp("mimetype:", name)) { } else if (!stringlowercmp("mimetype:", name)) {
mtype = data; mtype = data;
LOGDEB(("MHExecMultiple: got mimetype [%s]\n", data.c_str())); LOGDEB(("MHExecMultiple: got mimetype [%s]\n", data.c_str()));
@ -274,13 +282,14 @@ bool MimeHandlerExecMultiple::next_document()
// Charset. For many document types it doesn't matter. For text // Charset. For many document types it doesn't matter. For text
// and html it does. We supply a default from the // and html it does. We supply a default from the
// configuration. We may want to process a charset parameter in // configuration. We should do the text transcoding to utf-8 here
// filter output one day. We should do the // like exec::finaldetails does.
// text transcoding to utf-8 here like exec::finaldetails does. if (charset.empty()) {
string charset = cfgFilterOutputCharset.empty() ? "utf-8" : charset = cfgFilterOutputCharset.empty() ? "utf-8" :
cfgFilterOutputCharset; cfgFilterOutputCharset;
if (!stringlowercmp("default", charset)) { if (!stringlowercmp("default", charset)) {
charset = m_dfltInputCharset; charset = m_dfltInputCharset;
}
} }
m_metaData["charset"] = charset; m_metaData["charset"] = charset;