#include "postgres.h"
#include "fmgr.h"
#include "mb/pg_wchar.h"
Go to the source code of this file.
◆ iso8859_1_to_utf8()
Definition at line 38 of file utf8_and_iso8859_1.c.
39{
44 unsigned char *
start = src;
46
48
50 {
53 {
54 if (noError)
55 break;
57 }
60 else
61 {
62 *
dest++ = (
c >> 6) | 0xc0;
64 }
65 src++;
67 }
69
71}
#define IS_HIGHBIT_SET(ch)
#define PG_GETARG_CSTRING(n)
#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)
References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, HIGHBIT, IS_HIGHBIT_SET, len, PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN1, PG_RETURN_INT32, PG_UTF8, report_invalid_encoding(), and start.
◆ PG_FUNCTION_INFO_V1() [1/2]
◆ PG_FUNCTION_INFO_V1() [2/2]
◆ utf8_to_iso8859_1()
Definition at line 74 of file utf8_and_iso8859_1.c.
75{
80 unsigned char *
start = src;
82 c1;
83
85
87 {
90 {
91 if (noError)
92 break;
94 }
95
97 {
99 src++;
101 }
102 else
103 {
105
107 {
108 if (noError)
109 break;
111 }
112 if (l != 2)
113 {
114 if (noError)
115 break;
117 (
const char *) src,
len);
118 }
119 c1 = src[1] & 0x3f;
120 c = ((
c & 0x1f) << 6) | c1;
121 if (
c >= 0x80 &&
c <= 0xff)
122 {
123 *
dest++ = (
unsigned char)
c;
124 src += 2;
126 }
127 else
128 {
129 if (noError)
130 break;
132 (
const char *) src,
len);
133 }
134 }
135 }
137
139}
void report_untranslatable_char(int src_encoding, int dest_encoding, const char *mbstr, int len)
bool pg_utf8_islegal(const unsigned char *source, int length)
References CHECK_ENCODING_CONVERSION_ARGS, generate_unaccent_rules::dest, IS_HIGHBIT_SET, len, PG_GETARG_BOOL, PG_GETARG_CSTRING, PG_GETARG_INT32, PG_LATIN1, PG_RETURN_INT32, PG_UTF8, pg_utf8_islegal(), pg_utf_mblen, report_invalid_encoding(), report_untranslatable_char(), and start.
◆ PG_MODULE_MAGIC