{"id":351,"date":"2009-11-28T06:44:46","date_gmt":"2009-11-28T10:44:46","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=351"},"modified":"2013-03-30T06:49:38","modified_gmt":"2013-03-30T10:49:38","slug":"invalid-byte-sequence-for-encoding-utf8","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/invalid-byte-sequence-for-encoding-utf8","title":{"rendered":"invalid byte sequence for encoding &#8220;UTF8&#8221;"},"content":{"rendered":"<p><strong>Error:<\/strong><\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>root@host [~]#\u00a0 psql databasename &lt; dump.sql<\/strong><\/span><\/p>\n<p><span style=\"color: #0000ff;\"><strong>ERROR:\u00a0 invalid byte sequence for encoding &#8220;UTF8&#8221;: 0xd1e9<br \/>\nHINT:\u00a0 This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by &#8220;client_encoding&#8221;.<\/strong><\/span><\/p><\/blockquote>\n<p>The above error is received while restoring a pgsql dump and when the clicnt_encoding of the database is mismatched.<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p><strong>1) Edit the dump.sql file<\/strong><\/p>\n<blockquote><p><strong><span style=\"color: #0000ff;\">vi dump.sql<\/span><\/strong><\/p><\/blockquote>\n<p><strong>2) Change the line<\/strong><\/p>\n<blockquote><p><span style=\"color: #0000ff;\"><strong>SET client_encoding = &#8216;SQL_ASCII&#8217;;<\/strong><\/span><\/p>\n<p><span style=\"color: #0000ff;\"><strong>to<\/strong><\/span><\/p>\n<p><span style=\"color: #0000ff;\"><strong>SET client_encoding = &#8216;latin-1&#8217;;<\/strong><\/span><\/p><\/blockquote>\n<p>i.e. you need to <strong><span style=\"color: #0000ff;\">change the client_encoding from &#8216;SQL_ASCII&#8217; to &#8216;latin-1&#8217;<\/span><\/strong>.<\/p>\n<p><strong>3) Save the file and restore the database once again.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error:<br \/>\nroot@host [~]#\u00a0 psql databasename &lt; dump.sql<br \/>\nERROR:\u00a0 invalid byte sequence for encoding &#8220;UTF8&#8221;: 0xd1e9<br \/>\nHINT:\u00a0 This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by &#8220;client_encoding&#8221;.<br \/>\nThe above error is received while restoring a pgsql dump and when the clicnt_encoding of the database is mismatched.<br \/>\nSolution:<br \/>\n1) Edit the dump.sql file<br \/>\nvi dump.sql<br \/>\n2) Change the line<br \/>\nSET client_encoding = &#8216;SQL_ASCII&#8217;;<br \/>\nto<br \/>\nSET client_encoding = &#8216;latin-1&#8217;;<br \/>\ni.e. you need to change the client_encoding from &#8216;SQL_ASCII&#8217; to &#8216;latin-1&#8217;.<br \/>\n3) Save the file and restore the database once again.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[450,457,453,455,456,449,452,454,451],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/351"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=351"}],"version-history":[{"count":3,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/351\/revisions"}],"predecessor-version":[{"id":353,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/351\/revisions\/353"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}