Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018Ae69wJS7sueQMUwNxV3nX
42 lines
1.3 KiB
C
42 lines
1.3 KiB
C
/*
|
|
* <iconv.h> for the MontaukOS NetSurf port.
|
|
*
|
|
* MontaukOS has no iconv. Rather than port GNU libiconv, this implements the
|
|
* three-function iconv API on top of libparserutils' charset codecs, which are
|
|
* already in the ports sysroot.
|
|
*
|
|
* That is a good fit rather than a bodge: libparserutils decodes a charset to
|
|
* UCS-4 and encodes UCS-4 back out, so iconv() is decode-then-encode through a
|
|
* UCS-4 staging buffer. The supported set is whatever libparserutils supports
|
|
* -- UTF-8, UTF-16, ASCII, ISO-8859-x and the Windows-125x range -- which is
|
|
* exactly the set the HTML parser can handle anyway, so nothing is lost that
|
|
* would otherwise have worked.
|
|
*
|
|
* NetSurf touches iconv only from utils/utf8.c.
|
|
*
|
|
* NOT SUPPORTED: the "//TRANSLIT" and "//IGNORE" suffixes glibc accepts. They
|
|
* are stripped and ignored; conversion uses libparserutils' LOOSE error mode,
|
|
* which substitutes rather than failing.
|
|
*/
|
|
#ifndef _MONTAUK_COMPAT_ICONV_H_
|
|
#define _MONTAUK_COMPAT_ICONV_H_
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef void *iconv_t;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
iconv_t iconv_open(const char *tocode, const char *fromcode);
|
|
size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
|
|
char **outbuf, size_t *outbytesleft);
|
|
int iconv_close(iconv_t cd);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|