{"id":1340,"date":"2020-04-13T21:06:00","date_gmt":"2020-04-13T19:06:00","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=1340"},"modified":"2020-05-30T08:54:09","modified_gmt":"2020-05-30T06:54:09","slug":"batch-change-encoding-to-utf-8-for","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=1340","title":{"rendered":"batch change encoding to UTF-8 for several text (php) files"},"content":{"rendered":"<p>You can use recode<br \/>\nrecode UTF-8 *.php -v<\/p>\n<p>provided that all the files have the same encoding.<br \/>\nOtherwise you can try with something like<br \/>\niconv -f US-ASCII -t UTF-8 *.php<\/p>\n<h3>a minor problem<\/h3>\n<p>It could be an apparent problem if there aren&#8217;t non-ascii characters in a file: then these files are yet recognized, with<br \/>\n<code>file -i --mime-encoding *<\/code><br \/>\nas us-ascii.<br \/>\nSo you can add a non ascii character, like \u00e8:<br \/>\nsed -i -e &#8220;$a\u00e8&#8221; *.php<\/p>\n<p>and afterwards redo the command &#8220;recode&#8221; as above and replace some ascii expression, like agrave; with UFT-8 \u00e0 character.<br \/>\nEventually you will delete the &#8220;\u00e8&#8221; from the end of the files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use recode recode UTF-8 *.php -v provided that all the files have the same encoding. Otherwise you can try with something like iconv -f US-ASCII -t UTF-8 *.php a minor problem It could be an apparent problem if there aren&#8217;t non-ascii characters in a file: then these files are yet recognized, with file &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=1340\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;batch change encoding to UTF-8 for several text (php) files&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[566],"tags":[16,17,18,8,19],"class_list":["post-1340","post","type-post","status-publish","format-standard","hentry","category-webmaster","tag-change-encoding","tag-php","tag-unicode","tag-utf-8","tag-website"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1340"}],"version-history":[{"count":4,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1340\/revisions"}],"predecessor-version":[{"id":2039,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1340\/revisions\/2039"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}