Re: UTF-8 encoding failure

From: "Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
To: Martin Schäfer <Martin(dot)Schaefer(at)cadcorp(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: UTF-8 encoding failure
Date: 2010-03-25 16:23:30
Message-ID: 1FEF339CC919403C97DE3E4C36D23906@acer08f817a9b5
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Martin-san.

Probably it is not a bug.
Does this help you?
Please see.

C:\home\HIROSHI>cl TestPostgreSQLJapanese.cpp -I"C:\Program Files\PostgreSQL\8.4
\include" "C:\Program Files\PostgreSQL\8.4\lib\libpq.lib"
Microsoft(R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

TestPostgreSQLJapanese.cpp
WINVER not defined. Defaulting to 0x0600 (Windows Vista)
c:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE\afxwin1.inl(105)
: warning C4530: C++ 例外処理を使っていますが、アンワインド セマンティクスは有効
にはなりません。/EHsc を指定してください。
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:TestPostgreSQLJapanese.exe
TestPostgreSQLJapanese.obj
"C:\Program Files\PostgreSQL\8.4\lib\libpq.lib"

C:\home\HIROSHI>set Path=%Path%;C:\Program Files\PostgreSQL\8.4\bin;

C:\home\HIROSHI>TestPostgreSQLJapanese.exe
Testing with encoding UTF-8:
NOTICE: CREATE TABLE will create implicit sequence "蝗帛ョ誉gid_seq" for serial
column "蝗帛ョ・gid"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "蝗帛ョ誉pkey" for
table "蝗帛ョ・

Testing with encoding SJIS:
NOTICE: CREATE TABLE will create implicit sequence "四宗_gid_seq" for serial co
lumn "四宗.gid"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "四宗_pkey" for t
able "四宗"

Press any key to exit.

Regards,
Hiroshi Saito

----- Original Message -----
From: "Martin Schäfer" <Martin(dot)Schaefer(at)cadcorp(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Sent: Thursday, March 25, 2010 8:27 PM
Subject: [BUGS] UTF-8 encoding failure

Hi,

Is this the right place to report bugs?

The attached program creates a table with Japanese column names. When the column names are
retrieved in a query using PQfname, and invalid string is returned. The invalid column names
can also be seen in PGAdmin III. This only seems to happen with one (or more?) specific
Japanese character.

Operating System: Windows Vista Ultimate SP2 32bit
PostgreSQL server versions: 8.4.2 and 8.3.3 both fail
libpq version: 8.3.6
Database encoding: UTF8
Client encoding:
- UTF8: does not return the same column name used to create the table.
- SJIS: "select * from table" fails with error:
ERROR: invalid byte sequence for encoding "UTF8": 0xe59eff
HINT: This error can also happen if the byte sequence does not match the encoding
expected by the server, which is controlled by "client_encoding".

From what I can see the character in question has the following encodings:
SJIS: 8c b4
UTF-16: 9f 53
UTF-8: e5 8e 9f

Any chance this problem could be fixed soon?

Bye,

Martin Schäfer
Principal Software Engineer
Cadcorp
Computer Aided Development Corporation Ltd.
1 Heathcock Court, London, WC2R 0NT
martin(dot)schaefer(at)cadcorp(dot)com
www.cadcorp.com
****************************************************************************
This email is confidential and may be privileged and should not be used, read
or copied by anyone who is not the original intended recipient. If you have
received this email in error please inform the sender and delete it from
your mailbox or any other storage mechanism. Unless specifically stated,
nothing in this email constitutes an offer by Cadcorp and Cadcorp does not
warrant that any information contained in this email is accurate.
Cadcorp cannot accept liability for any statements made which are clearly the
sender's own and not expressly made on behalf of Cadcorp or one of its agents.
Please rely on your own virus check. No responsibility is taken by Cadcorp
for any damage arising out of any bug or virus infection.
****************************************************************************

--------------------------------------------------------------------------------

>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

Attachment Content-Type Size
TestPostgreSQLJapanese.cpp text/plain 3.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff 2010-03-25 16:26:39 Re: GIN overlap vs empty arrays
Previous Message Tom Lane 2010-03-25 15:44:19 Re: GIN overlap vs empty arrays