上传CSV文件,扭曲字符

时间:2017-07-26 10:05:32

标签: postgresql

通过以下查询上传csv文件时遇到问题

COPY adwords_initial("Account",
"Week",
"Campaign",
"Keyword",
"Ad group",
"Keyword state",
"Match type",
"Max. CPC",
"Clicks",
"Impressions",
"Cost",
"Avg. position",
"Ad group state",
"Campaign state",
"Status",
"Qual. score (hist.)",
"Expected clickthrough rate (hist.)",
"Ad relevance (hist.)",
"Landing page experience (hist.)",
"First page CPC",
"First position CPC",
"Top of page CPC",
"Bounce rate","Pages / session",
"Avg. session duration (seconds)",
"% new sessions",
"Search Exact match IS",
"Search Lost IS (rank)",
"Search Impr. share",
"Conversions",
"Conv. rate") 
FROM 'C:\Users\iantu\Desktop\Performance Marketing\Report inputs\input.csv' 
 DELIMITER ',' CSV HEADER encoding 'windows-1251';

法语中的字符不作为示例进行相应翻译

in keyword the original file has  +connectivité +IoT
in keyword the postgresql file has  +connectivitй +IoT

是否必须在我的应用程序中更改设置?

我还应该提一下,然后我使用以下查询导出它,但是,可以看到的数据在数据库中已经损坏。

COPY (SELECT * FROM adwords_initial) TO 'C:\Users\iantu\Desktop\Performance Marketing\Report Outputs\in between workflow.csv' WITH CSV HEADER;

1 个答案:

答案 0 :(得分:0)

使用latin1作为编码:

COPY adwords_initial("Account",
"Week",
"Campaign",
"Keyword",
"Ad group",
"Keyword state",
"Match type",
"Max. CPC",
"Clicks",
"Impressions",
"Cost",
"Avg. position",
"Ad group state",
"Campaign state",
"Status",
"Qual. score (hist.)",
"Expected clickthrough rate (hist.)",
"Ad relevance (hist.)",
"Landing page experience (hist.)",
"First page CPC",
"First position CPC",
"Top of page CPC",
"Bounce rate","Pages / session",
"Avg. session duration (seconds)",
"% new sessions",
"Search Exact match IS",
"Search Lost IS (rank)",
"Search Impr. share",
"Conversions",
"Conv. rate") 
FROM 'C:\Users\iantu\Desktop\Performance Marketing\Report inputs\input.csv' 
 DELIMITER ',' CSV HEADER encoding 'latin1';