Arabic and English text in PostgreSQL database Arabic and English text in PostgreSQL database postgresql postgresql

Arabic and English text in PostgreSQL database


The Windows console doesn't speak Unicode of any form by default, it speaks a "native" codepage. Which codepage depends on your Windows install's language settings.

If you chcp 65001 then it'll switch into utf-8.

Overall, though, text encoding handling in batch/cmd files and the Windows command line is absolutely awful. I generally recommend that you instead put anything that isn't basically 7-bit ASCII into a separate .sql file and execute it via psql -f with a suitable client_encoding; the PGCLIENTENCODING environment variable is useful for this.

So try:

SET PGCLIENTENCODING=utf-8psql.exe --username=postgres --dbname=dbname -f populate.sql