Re: [GENERAL] psql weird behaviour with charset encodings

From: hgonzalez(at)gmail(dot)com
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] psql weird behaviour with charset encodings
Date: 2010-05-08 22:50:51
Message-ID: 000e0cd64822e8870604861d0168@google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Well, I finally found some related -rather old- issues in Bugzilla (glib)

http://sources.redhat.com/bugzilla/show_bug.cgi?id=6530
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208308
http://sources.redhat.com/bugzilla/show_bug.cgi?id=649

The last explains why they do not consider it a bug:

ISO C99 requires for %.*s to only write complete characters that fit below
the
precision number of bytes. If you are using say UTF-8 locale, but ISO-8859-1
characters as shown in the input file you provided, some of the strings are
not valid UTF-8 strings, therefore sprintf fails with -1 because of the
encoding error. That's not a bug in glibc.

It's clear, though it's also rather ugly, from a specification point of
view (we must
count raw bytes for the width field, but also must decode the utf8 chars
for finding
character boundaries). I guess we must live with that.

Hernán J. González

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-05-08 23:03:26 Re: Documentation availability as a single page of text
Previous Message hernan gonzalez 2010-05-08 17:08:02 Re: psql weird behaviour with charset encodings

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-05-08 22:51:43 Re: max_standby_delay considered harmful
Previous Message Dimitri Fontaine 2010-05-08 21:02:51 Re: max_standby_delay considered harmful