--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1252/Makefile,v 1.1 2004/12/02 22:14:37 momjian Exp $
+#
+#-------------------------------------------------------------------------
+subdir = src/backend/utils/mb/conversion_procs/utf8_and_win1252
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := utf8_and_win1252
+
+include $(srcdir)/../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * WIN1252 and UTF-8
+ *
+ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c,v 1.1 2004/12/02 22:14:37 momjian Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+#include "../../Unicode/utf8_to_win1252.map"
+#include "../../Unicode/win1252_to_utf8.map"
+
+PG_FUNCTION_INFO_V1(utf_to_win1252);
+PG_FUNCTION_INFO_V1(win1252_to_utf);
+
+extern Datum utf_to_win1252(PG_FUNCTION_ARGS);
+extern Datum win1252_to_utf(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * CSTRING, -- source string (null terminated C string)
+ * CSTRING, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns VOID;
+ * ----------
+ */
+
+Datum
+utf_to_win1252(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1252);
+ Assert(len >= 0);
+
+ UtfToLocal(src, dest, ULmapWIN1252,
+ sizeof(ULmapWIN1252) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_VOID();
+}
+
+Datum
+win1252_to_utf(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1252);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len >= 0);
+
+ LocalToUtf(src, dest, LUmapWIN1252,
+ sizeof(LUmapWIN1252) / sizeof(pg_local_to_utf), PG_WIN1252, len);
+
+ PG_RETURN_VOID();
+}
* Encoding names and routines for work with it. All
* in this file is shared bedween FE and BE.
*
- * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.20 2004/09/27 23:24:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.21 2004/12/02 22:14:36 momjian Exp $
*/
#ifdef FRONTEND
#include "postgres_fe.h"
{
"win1251", PG_WIN1251
}, /* alias for Windows-1251 */
+ {
+ "win1252", PG_WIN1252
+ }, /* alias for Windows-1252 */
{
"win1256", PG_WIN1256
}, /* alias for Windows-1256 */
{
"windows1251", PG_WIN1251
}, /* Windows-1251; Microsoft */
+ {
+ "windows1252", PG_WIN1252
+ }, /* Windows-1252; Microsoft */
{
"windows1256", PG_WIN1256
}, /* Windows-1256; Microsoft */
{
"WIN1250", PG_WIN1250
},
+ {
+ "WIN1252", PG_WIN1252
+ },
{
"SJIS", PG_SJIS
},
-/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.52 2004/09/17 21:59:57 petere Exp $ */
+/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.53 2004/12/02 22:14:38 momjian Exp $ */
#ifndef PG_WCHAR_H
#define PG_WCHAR_H
PG_ISO_8859_7, /* ISO-8859-7 */
PG_ISO_8859_8, /* ISO-8859-8 */
PG_WIN1250, /* windows-1250 */
+ PG_WIN1252, /* windows-1252 */
/* followings are for client encoding only */
PG_SJIS, /* Shift JIS (Winindows-932) */