postgresql - POSTGRES foreign languages -
i have problem directly inserting foreign characters "ó,č,ĕ,ř" characters database. dont working php frontend sure there no transformation or other encoding. im using logged in psql directly , here setup :
server_encoding ----------------- utf8 (1 row)
and
client_encoding ----------------- utf8 (1 row)
database :
name | owner | encoding | collate | ctype | my_db | postgres | utf8 | en_us.utf-8 | en_us.utf-8 |
so guess there should no problem.
i created :
create table test (a text);
and want insert text
insert test (a) ('ó');
and there message :
error: invalid byte sequence encoding "utf8": 0xf327293b
is there can me please? looks ignoring input encoding or dont know.
edit :
my terminal configuration
lang=en_us.utf-8 language=en_us:en lc_ctype="en_us.utf-8" lc_numeric="en_us.utf-8" lc_time="en_us.utf-8" lc_collate="en_us.utf-8" lc_monetary="en_us.utf-8" lc_messages="en_us.utf-8" lc_paper="en_us.utf-8" lc_name="en_us.utf-8" lc_address="en_us.utf-8" lc_telephone="en_us.utf-8" lc_measurement="en_us.utf-8" lc_identification="en_us.utf-8" lc_all=
edit2:
my_db=# \encoding utf8
edit3: psql file
file
file -bi test text/plain; charset=utf-8
execute
error: syntax error @ or near "'Ăł'" line 1: insert tes (a) ('Ăł');
edit4:
set client_encoding='latin1';
this works in psql need works utf8. know possible used setup everytime mysql databases , works charm.
my jdbc driver needs utf8.
edit5:
here doing here : click me
before stored can see - php working fine - , after when read db cant see it. thats because moved closer db psql see whats going on. looks maybe server issue. possible server can't handle characters?
edit6:
tomcat config
-dfile.encoding=utf8
uri encoding set utf8 too. can problem? :(
if shell in latin1 encoding, appears comments, fix it:
set client_encoding = 'latin1';
if don't want change client's system encoding can change default in postgresql.conf
client_encoding = latin1
or change php's default character encoding:
default_charset = "utf-8";
do in apache, or whatever http server using, config:
adddefaultcharset utf-8
Comments
Post a Comment