Unix Technical Forum

Re: UTF8 or Unicode

This is a discussion on Re: UTF8 or Unicode within the pgsql Hackers forums, part of the PostgreSQL category; --> -----Original Message----- From: pgsql-hackers-owner@postgresql.org on behalf of Oliver Jowett Sent: Fri 2/18/2005 11:27 AM To: Karel Zak Cc: List ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 03:46 AM
Dave Page
 
Posts: n/a
Default Re: UTF8 or Unicode




-----Original Message-----
From: pgsql-hackers-owner@postgresql.org on behalf of Oliver Jowett
Sent: Fri 2/18/2005 11:27 AM
To: Karel Zak
Cc: List pgsql-hackers
Subject: Re: [HACKERS] UTF8 or Unicode

Karel Zak wrote:

>> Yes, I think we should fix it and remove UNICODE and WIN encoding names
>> from PG code.

>
> The JDBC driver asks for a UNICODE client encoding before it knows the
> server version it is talking to. How do you avoid breaking this?


So does pgAdmin.

Regards, Dave

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 03:47 AM
Bruce Momjian
 
Posts: n/a
Default Re: UTF8 or Unicode

Dave Page wrote:
> Karel Zak wrote:
>
> >> Yes, I think we should fix it and remove UNICODE and WIN encoding names
> >> from PG code.

> >
> > The JDBC driver asks for a UNICODE client encoding before it knows the
> > server version it is talking to. How do you avoid breaking this?

>
> So does pgAdmin.


I think we just need to _favor_ UTF8. The question is where are we
favoring Unicode rather than UTF8?

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 03:47 AM
Tom Lane
 
Posts: n/a
Default Re: UTF8 or Unicode

Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I think we just need to _favor_ UTF8.


I agree.

> The question is where are we
> favoring Unicode rather than UTF8?


It's the canonical name of the encoding, both in the code and the docs.

regression=# create database e encoding 'utf-8';
CREATE DATABASE
regression=# \l
List of databases
Name | Owner | Encoding
------------+----------+-----------
e | postgres | UNICODE
regression | postgres | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(5 rows)

As soon as we decide whether the canonical name is "UTF8" or "UTF-8"
;-) we can fix it.

regards, tom lane

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 03:49 AM
Bruce Momjian
 
Posts: n/a
Default Re: UTF8 or Unicode

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I think we just need to _favor_ UTF8.

>
> I agree.
>
> > The question is where are we
> > favoring Unicode rather than UTF8?

>
> It's the canonical name of the encoding, both in the code and the docs.
>
> regression=# create database e encoding 'utf-8';
> CREATE DATABASE
> regression=# \l
> List of databases
> Name | Owner | Encoding
> ------------+----------+-----------
> e | postgres | UNICODE
> regression | postgres | SQL_ASCII
> template0 | postgres | SQL_ASCII
> template1 | postgres | SQL_ASCII
> (5 rows)
>
> As soon as we decide whether the canonical name is "UTF8" or "UTF-8"
> ;-) we can fix it.


I checked and it looks like "UTF-8" is the correct usage:

http://www.unicode.org/glossary/

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 03:49 AM
Tatsuo Ishii
 
Posts: n/a
Default Re: UTF8 or Unicode

I do not object the changing UNICODE->UTF-8, but all these discussions
sound a little bit funny to me.

If you want to blame UNICODE, you should blame LATIN1 etc. as
well. LATIN1(ISO-8859-1) is actually a character set name, not an
encoding name. ISO-8859-1 can be encoded in 8-bit single byte
stream. But it can be encoded in 7-bit too. So when we refer to
LATIN1(ISO-8859-1), it's not clear if it's encoded in 7/8-bit.
--
Tatsuo Ishii

From: Bruce Momjian <pgman@candle.pha.pa.us>
Subject: Re: [HACKERS] UTF8 or Unicode
Date: Mon, 21 Feb 2005 22:08:25 -0500 (EST)
Message-ID: <200502220308.j1M38PV03238@candle.pha.pa.us>

> Tom Lane wrote:
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > I think we just need to _favor_ UTF8.

> >
> > I agree.
> >
> > > The question is where are we
> > > favoring Unicode rather than UTF8?

> >
> > It's the canonical name of the encoding, both in the code and the docs.
> >
> > regression=# create database e encoding 'utf-8';
> > CREATE DATABASE
> > regression=# \l
> > List of databases
> > Name | Owner | Encoding
> > ------------+----------+-----------
> > e | postgres | UNICODE
> > regression | postgres | SQL_ASCII
> > template0 | postgres | SQL_ASCII
> > template1 | postgres | SQL_ASCII
> > (5 rows)
> >
> > As soon as we decide whether the canonical name is "UTF8" or "UTF-8"
> > ;-) we can fix it.

>
> I checked and it looks like "UTF-8" is the correct usage:
>
> http://www.unicode.org/glossary/
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman@candle.pha.pa.us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-11-2008, 03:51 AM
Bruce Momjian
 
Posts: n/a
Default Re: UTF8 or Unicode

Tatsuo Ishii wrote:
> I do not object the changing UNICODE->UTF-8, but all these discussions
> sound a little bit funny to me.
>
> If you want to blame UNICODE, you should blame LATIN1 etc. as
> well. LATIN1(ISO-8859-1) is actually a character set name, not an
> encoding name. ISO-8859-1 can be encoded in 8-bit single byte
> stream. But it can be encoded in 7-bit too. So when we refer to
> LATIN1(ISO-8859-1), it's not clear if it's encoded in 7/8-bit.


Wow, Tatsuo has a point here. Looking at encnames.c, I see:

"UNICODE", PG_UTF8

but also:

"WIN", PG_WIN1251
"LATIN1", PG_LATIN1

and I see conversions for those:

"iso88591", PG_LATIN1
"win", PG_WIN1251

so I see what he is saying. We are not consistent in favoring the
official names vs. the common names.

I will work on a patch that people can review and test.

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-11-2008, 03:51 AM
Peter Eisentraut
 
Posts: n/a
Default Re: UTF8 or Unicode

Bruce Momjian wrote:
> We are not consistent in favoring the
> official names vs. the common names.


The problem is rather that there are too many standards and conventions
to choose from.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-11-2008, 03:51 AM
Karel Zak
 
Posts: n/a
Default Re: UTF8 or Unicode

On Thu, 2005-02-24 at 23:51 -0500, Bruce Momjian wrote:
> Tatsuo Ishii wrote:
> > I do not object the changing UNICODE->UTF-8, but all these discussions
> > sound a little bit funny to me.
> >
> > If you want to blame UNICODE, you should blame LATIN1 etc. as
> > well. LATIN1(ISO-8859-1) is actually a character set name, not an
> > encoding name. ISO-8859-1 can be encoded in 8-bit single byte
> > stream. But it can be encoded in 7-bit too. So when we refer to
> > LATIN1(ISO-8859-1), it's not clear if it's encoded in 7/8-bit.

>
> Wow, Tatsuo has a point here. Looking at encnames.c, I see:
>
> "UNICODE", PG_UTF8
>
> but also:
>
> "WIN", PG_WIN1251
> "LATIN1", PG_LATIN1


> so I see what he is saying. We are not consistent in favoring the
> official names vs. the common names.


Yes. I said already. For example "WIN" is extremely bad alias. It all is
heritage from old versions.

> I will work on a patch that people can review and test.


Thanks.

Karel

--
Karel Zak <zakkr@zf.jcu.cz>


---------------------------(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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-11-2008, 03:51 AM
Peter Eisentraut
 
Posts: n/a
Default Re: UTF8 or Unicode

Am Freitag, 25. Februar 2005 05:51 schrieb Bruce Momjian:
> so I see what he is saying. We are not consistent in favoring the
> official names vs. the common names.
>
> I will work on a patch that people can review and test.


I think this is what we should do:

UNICODE => UTF8
ALT => WIN866
WIN => WIN1251
TCVN => WIN1258

That should clear it up.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-11-2008, 03:51 AM
Bruce Momjian
 
Posts: n/a
Default Re: UTF8 or Unicode

Peter Eisentraut wrote:
> Am Freitag, 25. Februar 2005 05:51 schrieb Bruce Momjian:
> > so I see what he is saying. We are not consistent in favoring the
> > official names vs. the common names.
> >
> > I will work on a patch that people can review and test.

>
> I think this is what we should do:
>
> UNICODE => UTF8
> ALT => WIN866
> WIN => WIN1251
> TCVN => WIN1258


OK, but what about latin1?

--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:08 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com