diff options
| author | Tatsuo Ishii | 2004-03-15 10:41:26 +0000 |
|---|---|---|
| committer | Tatsuo Ishii | 2004-03-15 10:41:26 +0000 |
| commit | e8c32050371d06c0f61fed02acc554fe7a7e8c66 (patch) | |
| tree | eac210624a8f5b14c2aceafbe3ccae3d44172d7e /src/interfaces/libpq | |
| parent | 1bc2d544b979164a276f9e6052f0b6d23af59b60 (diff) | |
Add PQmbdsplen() which returns the "display length" of a character.
Still some works needed:
- UTF-8, MULE_INTERNAL always returns 1
Diffstat (limited to 'src/interfaces/libpq')
| -rw-r--r-- | src/interfaces/libpq/fe-misc.c | 12 | ||||
| -rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 3717998a6b1..d484747b9c5 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -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 $ * *------------------------------------------------------------------------- */ @@ -1096,6 +1096,16 @@ PQmblen(const unsigned char *s, int encoding) } /* + * 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. */ int diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index f6ea1f4ba74..293d50e690b 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -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); |
