pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: exclusion@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6742: pg_dump doesn't convert encoding of DB object names to OS encoding
Date: Wed, 18 Jul 2012 07:17:21 +0000
Message-ID: <E1SrOVd-00028F-Sz@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6742
Logged by:          Alexander LAW
Email address:      exclusion@gmail.com
PostgreSQL version: 9.1.4
Operating system:   Windows
Description:        

When I try to dump database with UTF-8 encoding in Windows, I get unreadable
object names.
Please look at the screenshot (http://oi50.tinypic.com/2lw6ipf.jpg). On the
left window all the pg_dump messages displayed correctly (except for the
prompt password (bug #6510)), but the non-ASCII object name is gibberish. On
the right window (where dump is done with the Windows 1251 encoding (OS
Encoding for Russian locale)) everything is right.

It seems that pg_dump doesn't do necessary encoding conversion for the
object names.
For example, there is a code in pg_dump.c:
    write_msg(NULL, "finding the columns and types of table \"%s\"\n",
        tbinfo->dobj.name);
or in backup_archiver.c
    ahlog(AH, 1, "setting owner and privileges for %s %s\n",
        te->desc, te->tag);

And then it comes to the following function in dumputils.c:
void
vwrite_msg(const char *modulename, const char *fmt, va_list ap)
{
...
        vfprintf(stderr, _(fmt), ap);
}

So the format string goes through the translation and encoding conversion
(for the current OS locale), but tbinfo->dobj.name (or te->tag) does not.
I think it would be appropriate to convert all the obect names with some
function like dump_output_encoding_to_OS_encoding.

Best regards,
Alexander




view thread (6+ messages)  latest in thread

Message-ID: <E1SrOVd-00028F-Sz@wrigleys.postgresql.org>
Permalink:  ../E1SrOVd-00028F-Sz@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1SrOVd-00028F-Sz@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: exclusion@gmail.com
  Subject: Re: BUG #6742: pg_dump doesn't convert encoding of DB object names to OS encoding
  In-Reply-To: <E1SrOVd-00028F-Sz@wrigleys.postgresql.org>
  References: <E1SrOVd-00028F-Sz@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox