-#ifdef HAVE_ICONV_H
-
-class IC_CharSetConverter
-{
-public:
- IC_CharSetConverter(IC_CharSet *from, IC_CharSet *to)
- {
- cnv = iconv_open(wxConvLibc.cWX2MB(to->cname),
- wxConvLibc.cWX2MB(from->cname));
- }
-
- ~IC_CharSetConverter()
- {
- if (cnv != (iconv_t)-1)
- iconv_close(cnv);
- }
-
- size_t Convert(char *buf, const char *psz, size_t n)
- {
- size_t inbuf = strlen(psz);
- size_t outbuf = n;
-#ifdef WX_ICONV_TAKES_CHAR
- size_t res = iconv( cnv, (char**)&psz, &inbuf, &buf, &outbuf );
-#else
- size_t res = iconv( cnv, &psz, &inbuf, &buf, &outbuf );
-#endif
- if (res == (size_t)-1)
- return (size_t)-1;
- return (n - outbuf);
- }
-
-public:
- iconv_t cnv;
-};
-
-#endif // HAVE_ICONV_H
-
-class EC_CharSetConverter
-{
-public:
- EC_CharSetConverter(EC_CharSet* from,EC_CharSet* to)
- { cnv.Init(from->enc,to->enc); }
-
- size_t Convert(char* buf, const char* psz, size_t n)
- {
- size_t inbuf = strlen(psz);
- if (buf) cnv.Convert(psz,buf);
- return inbuf;
- }
-
-public:
- wxEncodingConverter cnv;
-};
-