22#define PGSJISALTCODE 0x81ac
23#define PGEUCALTCODE 0xa2ae
31 .
name =
"euc_jp_and_sjis",
140 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1) + 0x74;
141 *p++ =
c2 - ((
c1 & 1) ? ((
c2 < 0xe0) ? 0x61 : 0x60) : 2);
172 k = (
c1 << 8) | (
c2 & 0xff);
177 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1) + 0x6f;
180 *p++ = ((
c1 - 0xa1) >> 1) + ((
c1 < 0xdf) ? 0x81 : 0xc1);
181 *p++ =
c2 - ((
c1 & 1) ? ((
c2 < 0xe0) ? 0x61 : 0x60) : 2);
231 if (
c1 >= 0xa1 &&
c1 <= 0xdf)
244 if (k >= 0xed40 && k < 0xf040)
255 c1 = (k >> 8) & 0xff;
264 *p++ = ((
c1 & 0x3f) << 1) + 0x9f + (
c2 > 0x9e);
265 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
267 else if ((k >= 0xeb40 && k < 0xf040) || (k >= 0xfc4c && k <= 0xfcfc))
273 else if (k >= 0xf040 && k < 0xf540)
280 *p++ = ((
c1 & 0x3f) << 1) + 0xf3 + (
c2 > 0x9e);
281 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
283 else if (k >= 0xf540 && k < 0xfa40)
291 *p++ = ((
c1 & 0x3f) << 1) + 0xf3 + (
c2 > 0x9e);
292 *p++ =
c2 + ((
c2 > 0x9e) ? 2 : 0x60) + (
c2 < 0x80);
294 else if (k >= 0xfa40)
311 *p++ = 0x80 | ((k & 0xff00) >> 8);
312 *p++ = 0x80 | (k & 0xff);
316 *p++ = 0x80 | (k >> 8);
317 *p++ = 0x80 | (k & 0xff);
#define IS_HIGHBIT_SET(ch)
Datum euc_jp_to_sjis(PG_FUNCTION_ARGS)
static int sjis2euc_jp(const unsigned char *sjis, unsigned char *p, int len, bool noError)
Datum sjis_to_euc_jp(PG_FUNCTION_ARGS)
static int euc_jp2sjis(const unsigned char *euc, unsigned char *p, int len, bool noError)
#define PG_MODULE_MAGIC_EXT(...)
#define PG_GETARG_CSTRING(n)
#define PG_FUNCTION_INFO_V1(funcname)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
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)