Unix Technical Forum

Converting from LATIN1 to UNICODE encoding?

This is a discussion on Converting from LATIN1 to UNICODE encoding? within the pgsql Admins forums, part of the PostgreSQL category; --> I have a database that was created using the LATIN1 encoding. Is it necessary for me to convert the ...


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

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 05:16 AM
Scott Eade
 
Posts: n/a
Default Converting from LATIN1 to UNICODE encoding?

I have a database that was created using the LATIN1 encoding.

Is it necessary for me to convert the database to some other encoding
(e.g. UNICODE) before I can store non-LATIN1 characters or does
PostgreSQL catch these and encode them somehow?

I have actually been attempting to convert a database by doing a pg_dump
(from the LATIN1 database) followed by a pg_restore (to one created with
the UNICODE encoding). Seemed to work with a sparsely populated 8.0.3
database, but I am running into all sorts of problems with 7.3.10 (e.g.
corrupted database followed by corrupted pg_clog).

What about JDBC, how does it know the encoding of the data I throw at
it? I guess I should ask this last question on the JDBC list.

Thanks in advance for any comments.

Scott

---------------------------(end of broadcast)---------------------------
TIP 3: 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
  #2 (permalink)  
Old 04-10-2008, 05:16 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Converting from LATIN1 to UNICODE encoding?

On Wed, Sep 21, 2005 at 06:16:31PM +1000, Scott Eade wrote:
> I have a database that was created using the LATIN1 encoding.
>
> Is it necessary for me to convert the database to some other encoding
> (e.g. UNICODE) before I can store non-LATIN1 characters or does
> PostgreSQL catch these and encode them somehow?
>
> I have actually been attempting to convert a database by doing a pg_dump
> (from the LATIN1 database) followed by a pg_restore (to one created with
> the UNICODE encoding). Seemed to work with a sparsely populated 8.0.3
> database, but I am running into all sorts of problems with 7.3.10 (e.g.
> corrupted database followed by corrupted pg_clog).


Hmm. Do tell, what database did you use as template? Was it correctly
frozen? If not, has it suffered from Xid wraparound?

Try dumping the template database. If it succeeds, then it's OK. If it
complains in the same way, with a missing pg_clog file, there lies the
problem.

--
Alvaro Herrera http://www.planetpostgresql.org
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 05:16 AM
Peter Eisentraut
 
Posts: n/a
Default Re: Converting from LATIN1 to UNICODE encoding?

Am Mittwoch, 21. September 2005 10:16 schrieb Scott Eade:
> Is it necessary for me to convert the database to some other encoding
> (e.g. UNICODE) before I can store non-LATIN1 characters or does
> PostgreSQL catch these and encode them somehow?


Yes and no.

> I have actually been attempting to convert a database by doing a pg_dump
> (from the LATIN1 database) followed by a pg_restore (to one created with
> the UNICODE encoding).


That is the right method.

> Seemed to work with a sparsely populated 8.0.3
> database, but I am running into all sorts of problems with 7.3.10 (e.g.
> corrupted database followed by corrupted pg_clog).


That is the symptom of a different, much bigger problem. Encoding problems
certainly never corrupt the clog.

> What about JDBC, how does it know the encoding of the data I throw at
> it?


That depends on where your throws come from. As you surely know, Java mostly
uses Unicode internally, so the data sent by the JDBC driver to the database
is in Unicode, but as to what encoding the data that you input into your Java
program has, you need to sort that out with the Java library functions that
you use to read that data.

---------------------------(end of broadcast)---------------------------
TIP 4: 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
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 12:37 AM.


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