1/*-------------------------------------------------------------------------
3 * EUC_KR and MULE_INTERNAL
5 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
6 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
11 *-------------------------------------------------------------------------
19 .
name =
"euc_kr_and_mic",
28 * INTEGER, -- source encoding id
29 * INTEGER, -- destination encoding id
30 * CSTRING, -- source string (null terminated C string)
31 * CSTRING, -- destination string (null terminated C string)
32 * INTEGER, -- source string length
33 * BOOL -- if true, don't throw an error if conversion fails
36 * Returns the number of bytes successfully converted.
40static int euc_kr2mic(
const unsigned char *euc,
unsigned char *p,
int len,
bool noError);
41static int mic2euc_kr(
const unsigned char *mic,
unsigned char *p,
int len,
bool noError);
79 euc_kr2mic(
const unsigned char *euc,
unsigned char *p,
int len,
bool noError)
81 const unsigned char *
start = euc;
96 (
const char *) euc,
len);
105 {
/* should be ASCII */
111 (
const char *) euc,
len);
127 mic2euc_kr(
const unsigned char *mic,
unsigned char *p,
int len,
bool noError)
129 const unsigned char *
start = mic;
144 (
const char *) mic,
len);
157 (
const char *) mic,
len);
169 (
const char *) mic,
len);
#define IS_HIGHBIT_SET(ch)
static int mic2euc_kr(const unsigned char *mic, unsigned char *p, int len, bool noError)
static int euc_kr2mic(const unsigned char *euc, unsigned char *p, int len, bool noError)
PG_MODULE_MAGIC_EXT(.name="euc_kr_and_mic",.version=PG_VERSION)
PG_FUNCTION_INFO_V1(euc_kr_to_mic)
Datum mic_to_euc_kr(PG_FUNCTION_ARGS)
Datum euc_kr_to_mic(PG_FUNCTION_ARGS)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
void report_untranslatable_char(int src_encoding, int dest_encoding, const char *mbstr, int len)
void report_invalid_encoding(int encoding, const char *mbstr, int len)
#define CHECK_ENCODING_CONVERSION_ARGS(srcencoding, destencoding)
int pg_encoding_verifymbchar(int encoding, const char *mbstr, int len)