Check DB Encoding?


(Nic Hubbard) #1

Just wondering how I can check what character encoding our database is set for?


I really need to move our website from iso-8859-1 to UTF-8, so I need to start by figuring out what the DB is, then testing from there.



Thanks.


(Mitchell Essex) #2

I think this will do it
psql -l -U postgres



List of databases

Name | Owner | Encoding

-----------±---------±----------

benchmark | postgres | SQL_ASCII

matrix | matrix | UTF8

postgres | postgres | SQL_ASCII

template0 | postgres | SQL_ASCII

template1 | postgres | SQL_ASCII

(5 rows)


(Nic Hubbard) #3

Ok, our DB is SQL_ASCII. Which, I read really is not an encoding. So, would this mean it is fine to leave the DB as is, and I could be fine with UTF-8?


(Justin Cormack) #4

[quote]
Ok, our DB is SQL_ASCII. Which, I read really is not an encoding. So, would this mean it is fine to leave the DB as is, and I could be fine with UTF-8?

[/quote]



Yes, you can just use UTF8 content in SQL_ASCII, as basically all that means is the database wont barf on invalid UTF8 sequences. In normal usage you wont notice a difference.


(Nic Hubbard) #5

[quote]
Yes, you can just use UTF8 content in SQL_ASCII, as basically all that means is the database wont barf on invalid UTF8 sequences. In normal usage you wont notice a difference.

[/quote]



Thanks Justin.


(Nic Hubbard) #6

I finished our switch from iso-8859-1 to UTF-8 today. It was actually quite easy using the Find/Replace tool as well as an asset listing to list the content of all pages to see if there were any garbage characters. Plenty of testing done before by cloning assets then forcing UTF-8, but all in all, pretty good for 3 hours of work. :slight_smile:


(Keith Brown) #7

[quote]
I finished our switch from iso-8859-1 to UTF-8 today. It was actually quite easy using the Find/Replace tool as well as an asset listing to list the content of all pages to see if there were any garbage characters. Plenty of testing done before by cloning assets then forcing UTF-8, but all in all, pretty good for 3 hours of work. :slight_smile:

[/quote]



…now that one would be good for your community site.



K


(Nic Hubbard) #8

[quote]
…now that one would be good for your community site.



K

[/quote]



Did you see issues with the Community site?


(Keith Brown) #9

[quote]
Did you see issues with the Community site?

[/quote]



No - I meant just switching from the encoding type as a tutorial…


(Nic Hubbard) #10

[quote]
No - I meant just switching from the encoding type as a tutorial…

[/quote]



Got it. Could be interesting. Although, I worry other peoples experience with it might not be as easy as mine. :slight_smile: