1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +03:00

Add PQmbdsplen() which returns the "display length" of a character.

Still some works needed:
- UTF-8, MULE_INTERNAL always returns 1
This commit is contained in:
Tatsuo Ishii
2004-03-15 10:41:26 +00:00
parent 1bc2d544b9
commit e8c3205037
6 changed files with 261 additions and 45 deletions

View File

@@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.104 2003/11/29 19:52:12 pgsql Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.105 2004/03/15 10:41:26 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1095,6 +1095,16 @@ PQmblen(const unsigned char *s, int encoding)
return (pg_encoding_mblen(encoding, s));
}
/*
* returns the display length of the word beginning s, using the
* specified encoding.
*/
int
PQdsplen(const unsigned char *s, int encoding)
{
return (pg_encoding_dsplen(encoding, s));
}
/*
* Get encoding id from environment variable PGCLIENTENCODING.
*/

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.102 2004/01/09 02:02:43 momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.103 2004/03/15 10:41:26 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@@ -447,6 +447,9 @@ extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
/* Determine length of multibyte encoded char at *s */
extern int PQmblen(const unsigned char *s, int encoding);
/* Determine display length of multibyte encoded char at *s */
extern int PQdsplen(const unsigned char *s, int encoding);
/* Get encoding id from environment variable PGCLIENTENCODING */
extern int PQenv2encoding(void);