1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +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

@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.83 2004/03/14 04:25:17 tgl Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.84 2004/03/15 10:41:26 ishii Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -410,7 +410,7 @@ ReportSyntaxErrorPosition(const PGresult *result, const char *query)
{
qidx[i] = qoffset;
scridx[i] = scroffset;
scroffset += 1; /* XXX fix me when we have screen width info */
scroffset += PQdsplen(&query[qoffset], pset.encoding);
qoffset += PQmblen(&query[qoffset], pset.encoding);
}
qidx[i] = qoffset;
@@ -526,7 +526,7 @@ ReportSyntaxErrorPosition(const PGresult *result, const char *query)
scroffset = 0;
for (i = 0; i < msg.len; i += PQmblen(&msg.data[i], pset.encoding))
{
scroffset += 1; /* XXX fix me when we have screen width info */
scroffset += PQdsplen(&msg.data[i], pset.encoding);
}
/* Finish and emit the message. */