POSTGRES foreign languages

前端 未结 3 753
广开言路
广开言路 2021-01-27 14:07

I have problem with directly inserting foreign characters like \"ó,č,ĕ,ř\" characters into database. dont working even with my php frontend to be sure there is no transformation

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-27 14:48

    If your shell is in latin1 encoding, as it appears from the comments, this will fix it:

    set client_encoding = 'latin1';
    

    If you don't want to change the client's system encoding you can change the default in postgresql.conf

    client_encoding = latin1
    

    Or change PHP's default character encoding:

    default_charset = "utf-8";
    

    Do it also in the Apache, or whatever http server you are using, config:

    AddDefaultCharset UTF-8
    

提交回复
热议问题