sql - Arabic and English text in PostgreSQL database -
i need insert both english language , standard arabic text postgresql database.
i'm running next command via .bat script:
psql.exe --echo-all --username=postgres --dbname=dbname -f populate.sql populate.sql has statements this:
insert table1 (column1, column2) values (2, 'المستخدم '); if via pgadmin, works. thing need via .sql population scripts ran 1 time application started.
in case gibberish, this:
العرض
i created scripts in notepad++ using encode in utf-8 without bom option, since normal encoding in utf-8 adds character start of file , of inserts not made.
i'm assuming encode problem, have yet figure out wrong. databse in utf-8.
thanks in advance!
the windows console doesn't speak unicode of form default, speaks "native" codepage. codepage depends on windows install's language settings.
if chcp 65001 it'll switch utf-8.
overall, though, text encoding handling in batch/cmd files , windows command line absolutely awful. recommend instead set isn't 7-bit ascii separate .sql file , execute via psql -f suitable client_encoding; pgclientencoding environment variable useful this.
so try:
set pgclientencoding=utf-8 psql.exe --username=postgres --dbname=dbname -f populate.sql sql postgresql utf-8 character-encoding pgadmin
No comments:
Post a Comment