Re: Understanding Encoding

From: Gopal Tandon <gopal_tandon(at)ql2(dot)com>
To: Beena Emerson <memissemerson(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: Understanding Encoding
Date: 2013-09-06 06:01:47
Message-ID: CANKwf-1UJCW+4VhaPjOh-zJEtP6WfUXCDQTU82ASdreKM2j2EA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

You can refer : http://www.postgresql.org/docs/9.2/static/multibyte.html

On Fri, Sep 6, 2013 at 11:26 AM, Beena Emerson <memissemerson(at)gmail(dot)com>wrote:

> Hello All,
>
> I am not able to understand how the encoding is handled. I would be happy
> if someone can tell what is happening in the following scenario:
>
> 1. I have created a database with EUC_KR encoding and created a table and
> inserted some korean value into it.
>
> =# CREATE DATABASE korean WITH ENCODING 'EUC_KR' LC_COLLATE='ko_KR.euckr'
> LC_CTYPE='ko_KR.euckr' TEMPLATE=template0;
>
> =# \c korean
>
> korean=# SHOW client_encoding;
> client_encoding
> -----------------
> UTF8
> (1 row)
>
> korean=# CREATE TABLE tbl (doc text);
>
> korean=# INSERT INTO tbl VALUES ('그레스');
>
>
> 2. If I insert non-korean values it throws error:
>
> korean=# INSERT INTO tbl VALUES ('データベース');
> ERROR: character with byte sequence 0xe3 0x83 0xbc in encoding "UTF8" has
> no equivalent in encoding "EUC_KR"
>
> korean=# SELECT * FROM tbl;
> doc
> --------
> 그레스
> (1 row)
>
>
> 3. I change the client encoding to EUC_KR and try inserting the same
> korean characters and it throws an error:
>
> korean=# SET client_encoding = 'EUC_KR';
> SET
> korean=# INSERT INTO tbl VALUES ('그레스');
> ERROR: invalid byte sequence for encoding "EUC_KR": 0xa0 0x88
>
>
> Even the SELECT statement displays something different. I am not able to
> understand why?
>
> korean=# SELECT * FROM tbl;
> doc
> --------
> �׷���
> (1 row)
>
>
> Can someone please help me.
>
> Thanks you,
>
> Beena Emerson
>
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Amit Langote 2013-09-06 06:37:04 Re: [NOVICE] Understanding Encoding
Previous Message Beena Emerson 2013-09-06 05:56:52 Understanding Encoding

Browse pgsql-sql by date

  From Date Subject
Next Message Amit Langote 2013-09-06 06:37:04 Re: [NOVICE] Understanding Encoding
Previous Message Beena Emerson 2013-09-06 05:56:52 Understanding Encoding