#include "postgres.h"
#include "fmgr.h"
#include "mb/pg_wchar.h"
#include "../../Unicode/utf8_to_win1250.map"
#include "../../Unicode/utf8_to_win1251.map"
#include "../../Unicode/utf8_to_win1252.map"
#include "../../Unicode/utf8_to_win1253.map"
#include "../../Unicode/utf8_to_win1254.map"
#include "../../Unicode/utf8_to_win1255.map"
#include "../../Unicode/utf8_to_win1256.map"
#include "../../Unicode/utf8_to_win1257.map"
#include "../../Unicode/utf8_to_win1258.map"
#include "../../Unicode/utf8_to_win866.map"
#include "../../Unicode/utf8_to_win874.map"
#include "../../Unicode/win1250_to_utf8.map"
#include "../../Unicode/win1251_to_utf8.map"
#include "../../Unicode/win1252_to_utf8.map"
#include "../../Unicode/win1253_to_utf8.map"
#include "../../Unicode/win1254_to_utf8.map"
#include "../../Unicode/win1255_to_utf8.map"
#include "../../Unicode/win1256_to_utf8.map"
#include "../../Unicode/win1257_to_utf8.map"
#include "../../Unicode/win866_to_utf8.map"
#include "../../Unicode/win874_to_utf8.map"
#include "../../Unicode/win1258_to_utf8.map"
Go to the source code of this file.
Data Structures | |
struct | pg_conv_map |
Functions | |
PG_FUNCTION_INFO_V1 (win_to_utf8) | |
PG_FUNCTION_INFO_V1 (utf8_to_win) | |
Datum | win_to_utf8 (PG_FUNCTION_ARGS) |
Datum | utf8_to_win (PG_FUNCTION_ARGS) |
Variables | |
PG_MODULE_MAGIC | |
static pg_conv_map | maps [] |
PG_FUNCTION_INFO_V1 | ( | win_to_utf8 | ) |
PG_FUNCTION_INFO_V1 | ( | utf8_to_win | ) |
Datum utf8_to_win | ( | PG_FUNCTION_ARGS | ) |
Definition at line 132 of file utf8_and_win.c.
References CHECK_ENCODING_CONVERSION_ARGS, encoding, ereport, errcode(), errmsg(), ERROR, i, NULL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_RETURN_VOID, PG_UTF8, and UtfToLocal().
{ int encoding = PG_GETARG_INT32(1); unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); int i; CHECK_ENCODING_CONVERSION_ARGS(PG_UTF8, -1); for (i = 0; i < sizeof(maps) / sizeof(pg_conv_map); i++) { if (encoding == maps[i].encoding) { UtfToLocal(src, dest, maps[i].map2, NULL, maps[i].size2, 0, encoding, len); PG_RETURN_VOID(); } } ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("unexpected encoding ID %d for WIN character sets", encoding))); PG_RETURN_VOID(); }
Datum win_to_utf8 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 105 of file utf8_and_win.c.
References CHECK_ENCODING_CONVERSION_ARGS, encoding, ereport, errcode(), errmsg(), ERROR, i, LocalToUtf(), NULL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_RETURN_VOID, and PG_UTF8.
{ int encoding = PG_GETARG_INT32(0); unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2); unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3); int len = PG_GETARG_INT32(4); int i; CHECK_ENCODING_CONVERSION_ARGS(-1, PG_UTF8); for (i = 0; i < sizeof(maps) / sizeof(pg_conv_map); i++) { if (encoding == maps[i].encoding) { LocalToUtf(src, dest, maps[i].map1, NULL, maps[i].size1, 0, encoding, len); PG_RETURN_VOID(); } } ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("unexpected encoding ID %d for WIN character sets", encoding))); PG_RETURN_VOID(); }
pg_conv_map maps[] [static] |
Definition at line 68 of file utf8_and_win.c.
Definition at line 40 of file utf8_and_win.c.