Datum iso_to_mic(PG_FUNCTION_ARGS) { unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); CHECK_ENCODING_CONVERSION_ARGS(PG_ISO_8859_5, PG_MULE_INTERNAL); iso2mic(src, dest, len); PG_RETURN_VOID(); }
Datum iso_to_mic(PG_FUNCTION_ARGS) { unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); Assert(len >= 0); iso2mic(src, dest, len); PG_RETURN_VOID(); }
Datum iso_to_koi8r(PG_FUNCTION_ARGS) { unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); unsigned char *buf; CHECK_ENCODING_CONVERSION_ARGS(PG_ISO_8859_5, PG_KOI8R); buf = palloc(len * ENCODING_GROWTH_RATE + 1); iso2mic(src, buf, len); mic2koi8r(buf, dest, strlen((char *) buf)); pfree(buf); PG_RETURN_VOID(); }
Datum iso_to_win866(PG_FUNCTION_ARGS) { unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); unsigned char *buf; CHECK_ENCODING_CONVERSION_ARGS(PG_ISO_8859_5, PG_WIN866); /* Use mic/KOI8R as intermediary, see comment in win866_to_win1251() */ buf = palloc(len * ENCODING_GROWTH_RATE + 1); iso2mic(src, buf, len); mic2win866(buf, dest, strlen((char *) buf)); pfree(buf); PG_RETURN_VOID(); }
Datum iso_to_win866(PG_FUNCTION_ARGS) { unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); unsigned char *buf; Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_WIN866); Assert(len >= 0); buf = palloc(len * ENCODING_GROWTH_RATE); iso2mic(src, buf, len); mic2win866(buf, dest, strlen((char *) buf)); pfree(buf); PG_RETURN_VOID(); }