Thread: korean encoding, but sort order bad

korean encoding, but sort order bad

From
joseph speigle
Date:
hi,
To see the query results in native language see 

http://database.sarang.net/?inc=read&aid=5368&criteria=pgsql&subcrit=qna&id=&limit=20&keyword=&page=1

the simpler url is

http://database.sarang.net/?criteria=pgsql

becase there is no korean postgresql list.  poster is "joesp"

basically the characters are off when sorting.  As for how the koreans are doing things, that's why I'm asking them on
database.sarang.net. BTW is there another location to look for help in korea, if you are aware of one I would like to
knowit.  
 

I am at a crossroads why after the following the sort order is off.  I think I've followed all the advice from the
manual,as well.
 


[postgres@www pgsql]$ initdb --locale=ko_KR --lc-messages=C -E unicode -D `pwd`/unidata

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locales COLLATE:  ko_KR CTYPE:    ko_KR MESSAGES: C MONETARY: ko_KR
NUMERIC: ko_KR TIME:     ko_KR
 
creating directory /bup/pgsql/unidata ... ok
creating directory /bup/pgsql/unidata/global ... ok
creating directory /bup/pgsql/unidata/pg_xlog ... ok
creating directory /bup/pgsql/unidata/pg_clog ... ok
creating directory /bup/pgsql/unidata/base ... ok
creating directory /bup/pgsql/unidata/base/1 ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /bup/pgsql/unidata/base/1 ... ok
initializing pg_shadow ... ok
enabling unlimited row size for system tables ... ok
initializing pg_depend ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
Success. You can now start the database server using:   /usr/local/pgsql/bin/postmaster -D /bup/pgsql/unidata
or   /usr/local/pgsql/bin/pg_ctl -D /bup/pgsql/unidata -l logfile start
[postgres@www pgsql]$
[postgres@www pgsql]$ pg_ctl -D /bup/pgsql/unidata/ -o "-p5433" start
postmaster starting
[postgres@www pgsql]$ LOG:  database system was shut down at 2004-06-16 15:57:34 CDT
LOG:  checkpoint record is at 0/9F60DC
LOG:  redo record is at 0/9F60DC; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 490; next OID: 17207
LOG:  database system is ready
[postgres@www pgsql]$
[postgres@www pgsql]$ psql -p 5543 -d template1
Welcome to psql 7.5devel, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help with psql commands      \g
orterminate with semicolon to execute query      \q to quit
 
template1=# \dt
No relations found.
template1=#create database korean;
CREATE DATABASE
template1=\c korean
template1=\q
[postgres@www bup]$ psql -p 5543 -d korean < korean.sql
.... many insert statements, etc, as korean.sql is dump of other korean db
[postgres@www bup]$ psql -p 5543 -d korean
Welcome to psql 7.5devel, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help with psql commands      \g
orterminate with semicolon to execute query      \q to quit
 
korean=#
korean=# \encoding utf8
korean=# select id,word from korean order by word;id |   word
----+----------68 | 생성72 | 두가지67 | 설문69 | 단순하게66 | 강좌73 | 깔다65 | 막막70 | 반면71 | 지정
(9 rows)
korean=# \encoding unicode
korean=# select id,word from korean order by word;id |   word
----+----------68 | 생성72 | 두가지67 | 설문69 | 단순하게66 | 강좌73 | 깔다65 | 막막70 | 반면71 | 지정
(9 rows)(the order is incorrect and unsorted)
korean-# \l       List of databases  Name    |  Owner   | Encoding
-----------+----------+----------korean    | postgres | UNICODEtemplate0 | postgres | UNICODEtemplate1 | postgres |
UNICODE
(3 rows)
korean-#





-- 
joe speigle
www.sirfsup.com


Re: korean encoding, but sort order bad

From
Tom Lane
Date:
joseph speigle <joe.speigle@jklh.us> writes:
> [postgres@www pgsql]$ initdb --locale=ko_KR --lc-messages=C -E unicode -D `pwd`/unidata

Is that a valid combination of locale and encoding?  The locale setting
implies a particular encoding, but unfortunately Postgres has no way to
tell which one.  You may need a locale called "ko_KR.utf8" or similar
if you want to use unicode encoding.
        regards, tom lane