473,378 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Sorting in Unicode not working

Hi,

Our database contains Hindi as well as English characters. We
have specified the encoding to be unicode during initdb as well
as createdb commands.

Unfortunately sorting of the Hindi fields is not working. For
e.g. we have a person table and the query "SELECT * FROM PERSON
ORDERY BY LASTNAME" returns all the rows but the records are not
being sorted by the last name.

We tried this on Postgresql 7.3.2 as well as 7.4.1 but with no
luck. The OS we tried were Mandrake 9.1 and Fedora Core 1.

Do we need to do anything special to get Hindi/Unicode sorting
working in Postgresql?

Please help,

Hitesh
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #1
8 2002
Hitesh Bagadiya <ba******@yahoo.com> writes:
Our database contains Hindi as well as English characters. We
have specified the encoding to be unicode during initdb as well
as createdb commands.
Unfortunately sorting of the Hindi fields is not working.


You need to make sure you initdb with the right locale, not only
the right encoding. I dunno which locale you want ... but if
sort(1) sorts the way you want then Postgres should too.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #2
We did set the locate to hi_IN at initdb but sorting is not
working. One thing is that linux system is running on en_US
locale. Does this makes any difference?

hitesh
--- Tom Lane <tg*@sss.pgh.pa.us> wrote:
Hitesh Bagadiya <ba******@yahoo.com> writes:
Our database contains Hindi as well as English characters.

We
have specified the encoding to be unicode during initdb as

well
as createdb commands.
Unfortunately sorting of the Hindi fields is not working.


You need to make sure you initdb with the right locale, not
only
the right encoding. I dunno which locale you want ... but if
sort(1) sorts the way you want then Postgres should too.

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You need to make sure you initdb with the right locale, not only
the right encoding.


So in other words, all databases inside postgres must have the same (or at
least a compatible) encoding+locale in order to allow proper sorting or other
locale dependant things?

Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAd9fd1Xdt0HKSwgYRApjMAJ0aMilcPWmVSocljLD9PC 2PpAXgvgCfRI+H
I438s/mxrVmUHLwMOceMw6E=
=yV1G
-----END PGP SIGNATURE-----
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #4
Hitesh Bagadiya <ba******@yahoo.com> writes:
We did set the locate to hi_IN at initdb but sorting is not
working.


You should check that you have selected a database encoding that matches
what the locale expects. Also double-check that you really do have that
locale selected (use pg_controldata, or in 7.4 just "show lc_collate").

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #5
Holger Klawitter <li***@klawitter.de> writes:
So in other words, all databases inside postgres must have the same (or at
least a compatible) encoding+locale


Yup. strcoll()'s locale setting implicitly assumes a particular
encoding (at least on the platforms I'm familiar with), and so selecting
a database encoding that's incompatible with that will give you bizarre
sorting behavior. The apparent freedom to select a per-database
encoding is really illusory in the current PG system, at least if you
have specific ideas about what you want the sort order to be. You
pretty much have to get it right at initdb time.

There was a thread just a day or two back on pgsql-hackers about
generalizing our locale support, which would fix this problem among
others. I'm not sure how soon it will really happen though...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #6
Thanks for your help. The command shows that the locale is
en_US. Now I will try to figure out how to correctly set locale
to hi_IN.

hitesh

--- Tom Lane <tg*@sss.pgh.pa.us> wrote:
Hitesh Bagadiya <ba******@yahoo.com> writes:
We did set the locate to hi_IN at initdb but sorting is not
working.


You should check that you have selected a database encoding
that matches
what the locale expects. Also double-check that you really do
have that
locale selected (use pg_controldata, or in 7.4 just "show
lc_collate").

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #7
I set the locale to hi_IN during initdb. pg_controldata and show
lc_collate both show that locale is hi_IN. But postgresql is not
returning sorted records.

What can I do next to get sorting working on postgresql?

--- Tom Lane <tg*@sss.pgh.pa.us> wrote:
Hitesh Bagadiya <ba******@yahoo.com> writes:
We did set the locate to hi_IN at initdb but sorting is not
working.


You should check that you have selected a database encoding
that matches
what the locale expects. Also double-check that you really do
have that
locale selected (use pg_controldata, or in 7.4 just "show
lc_collate").

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #8
Hitesh Bagadiya <ba******@yahoo.com> writes:
I set the locale to hi_IN during initdb. pg_controldata and show
lc_collate both show that locale is hi_IN. But postgresql is not
returning sorted records.


There's still the other point about whether the database's character
set encoding matches what the locale setting requires.

For that matter, are you certain the locale itself works? Have you
checked that sort(1) produces the sort order you are expecting when
LC_ALL=hi_IN?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: Erlend Fuglum | last post by:
Hi everyone, I'm having some trouble sorting lists. I suspect this might have something to do with locale settings and/or character encoding/unicode. Consider the following example, text...
4
by: Stano Paska | last post by:
Hi, I have one problem. In file aaa.txt I have slovak letters in utf-8. zcaron scaron aacute ocircumflex tcaron
2
by: D. Roshani | last post by:
Hello ! I wonder if any one can help me to create a cosomize sorting order (as Macro or added small program in c++ or c# which does this work) in a Access Database contaning one table only words...
48
by: Zenobia | last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice features such as: * rewrite source code * check syntax * global search & replace (through several files at...
2
by: Vojislav | last post by:
How can I sort datatable according to unicode? I set corret regional and culture settings but Basic .Net sorts according Ascii. It sorts letters with accents like without them. thank you in...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
6
by: Dennis Gearon | last post by:
This is what has to be eventually done:(as sybase, and probably others do it) http://www.ianywhere.com/whitepapers/unicode.html I'm not sure how that will affect LIKE and REGEX. ...
8
by: DierkErdmann | last post by:
Hi ! I know that this topic has been discussed in the past, but I could not find a working solution for my problem: sorting (lists of) strings containing special characters like "ä", "ü",......
9
by: apattin | last post by:
HI all, Can someone explain this sorting issue? we are using V8 on Windows, but database *might* have been created with V7 (I can find out if it really matters) I have a table with one...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.