[SQL] Don't miss this
Hey, how are you? I've lost 10lbs since using this. http://j.mp/14IpV2H Try it for free, I promise it's the best. Let me know how well it works for you!
[SQL] Understanding Encoding
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
Re: [SQL] Understanding Encoding
You can refer : http://www.postgresql.org/docs/9.2/static/multibyte.html On Fri, Sep 6, 2013 at 11:26 AM, Beena Emerson 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 > > >
Re: [SQL] [NOVICE] Understanding Encoding
On Fri, Sep 6, 2013 at 2:56 PM, Beena Emerson 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) > I wonder if you have tried changing your "locale" to ko_KR; something like: LANG=ko_KR LC_ALL=ko_KR \ psql -d korean -- Amit Langote -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] [NOVICE] Understanding Encoding
> > I wonder if you have tried changing your "locale" to ko_KR; something like: > > LANG=ko_KR LC_ALL=ko_KR \ > psql -d korean > > Hi, It still gives same result: $ LANG=ko_KR LC_ALL=ko_KR $ psql -d korean korean=# SHOW client_encoding; client_encoding - EUC_KR (1 row) korean=# INSERT INTO tbl VALUES ('그레스'); ERROR: invalid byte sequence for encoding "EUC_KR": 0xa0 0x88 Beena Emerson
Re: [SQL] [NOVICE] Understanding Encoding
Beena Emerson writes: > It still gives same result: > $ LANG=ko_KR LC_ALL=ko_KR > $ psql -d korean > korean=# SHOW client_encoding; > client_encoding > - > EUC_KR > (1 row) > korean=# INSERT INTO tbl VALUES ('ê·¸ë ì¤'); > ERROR: invalid byte sequence for encoding "EUC_KR": 0xa0 0x88 What you need to figure out is what encoding the text you are typing is in. You're telling psql it's EUC_KR but it evidently isn't. If you're typing these characters manually then it's probably determined by a setting of the terminal-emulator program you're using. But if you're copying-and-pasting then things get more complicated. Also, what you did above is not what Amit suggested: he wanted you to put the variable assignments on the same command line as the psql invocation, so that they'd affect the environment passed to psql. I'm suspicious of his solution because I'd have thought the terminal program would set up the right environment ... but you might as well try it. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql