know the encoding of SRU parameters.
-/* $Id: charset-converter.cpp,v 1.1 2005-05-04 08:35:03 adam Exp $
+/* $Id: charset-converter.cpp,v 1.2 2005-05-06 06:55:54 adam Exp $
Copyright (c) 1998-2005, Index Data.
This file is part of the yaz-proxy.
Copyright (c) 1998-2005, Index Data.
This file is part of the yaz-proxy.
#include <yaz/proto.h>
#include "proxyp.h"
#include <yaz/proto.h>
#include "proxyp.h"
{
wrbuf_rewind(m_wrbuf);
wrbuf_iconv_write(m_wrbuf, m_ct, buf_in, len_in);
{
wrbuf_rewind(m_wrbuf);
wrbuf_iconv_write(m_wrbuf, m_ct, buf_in, len_in);
*len_out = wrbuf_len(m_wrbuf);
*len_out = wrbuf_len(m_wrbuf);
- *buf_out = (char*) odr_malloc(o, *len_out);
- memcpy(*buf_out, wrbuf_buf(m_wrbuf), *len_out);
+ if (*len_out == 0)
+ { // we assume conversion failed
+ *buf_out = buf_in;
+ *len_out = len_in;
+ }
+ else
+ {
+ *buf_out = (char*) odr_malloc(o, *len_out);
+ memcpy(*buf_out, wrbuf_buf(m_wrbuf), *len_out);
+ }
}
void Yaz_CharsetConverter::convert_type_1(Z_Term *q, ODR o)
}
void Yaz_CharsetConverter::convert_type_1(Z_Term *q, ODR o)