sql_ascii

From: Dennis Björklund <db(at)zigo(dot)dhs(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: sql_ascii
Date: 2003-06-12 18:29:25
Message-ID: Pine.LNX.4.44.0306121959260.13332-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Why do we have SQL_ASCII?

I could understand it if we only could store 7-bit strings there. But
SQL_ASCII lets you store 8-bit values. Should I understand SQL_ASCII
simply as 8-bit strings of unknown charset?

In the first database I created I used it to store latin1 strings, and
that was a mistake. I'm sure others have made the same mistake.

I've looked at the code and as far as I can tell postgres converts ascii
to utf-8 using a function in conv.c called pg_ascii2mic() which simply
strips off the upper bit. Still when I have a SQL_ASCII database and a
table with strings like "Björklund" (notice the ö which is not 7-bit
ascii) and change client encoding to UTF-8 I still get 8-bit values out
(yes, it's stange, that's why I ask).

I know how to fix my database, no problem. I'm just interested in why I
get 8-bit values out when I've set the client encoding to utf-8. I guess
my problem is the same as above, I don't know what sql_ascii really is.

I don't need to know these things to fix the small problems in psql (which
I'll do in the weekend), but I figured that it's just as good to
understand all of it an anyway.

--
/Dennis

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2003-06-12 18:41:34 Re: Pre-allocation of shared memory ...
Previous Message Sean Chittenden 2003-06-12 18:26:28 Re: CVS -Tip compile issue -- FreeBSD 4.8