当我使用pg_dump 备份postgres 时,出现错误,我该如何摆脱这个错误?

when I use pg_dump to back up postgres, an error occur, how can I get rid of this error?

输出信息在这里:

pg_dump: Dumping the contents of table "categorytype_show" failed: PQgetResult() failed. pg_dump: Error message from server: ERROR: character with byte sequence 0xef 0xbb 0xbf in encoding "UTF8" has no equivalent in encoding "GBK" pg_dump: The command was: COPY public.categorytype_show (categoryid, categorylevel, categoryname, categoryparentid, leafcategory, catalogenabled, autopayenabled, b2bvatenabled, bestofferenabled, expired, intlautosfixedcat, keywords, lsd, numofitems, orpa, orra, sellerguaranteeeligible, virtual, itemtype, isselect, imgurl, id, ctime) TO stdout;

他们的关键是:

ERROR: character with byte sequence 0xef 0xbb 0xbf in encoding "UTF8" has no equivalent in encoding "GBK"

您有一个编码错误。为了克服这个问题,将 UTF8 格式的数据转储为

pg_dump -E UTF8

还可以考虑使用 -Fc 选项 pg_dump。更多详情:https://www.postgresql.org/docs/9.1/static/app-pgdump.html