{"id":893,"date":"2013-02-20T16:18:13","date_gmt":"2013-02-20T23:18:13","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=893"},"modified":"2013-02-27T11:28:18","modified_gmt":"2013-02-27T18:28:18","slug":"convert-utf-16-file-to-utf-8","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=893","title":{"rendered":"Convert UTF-16 file to UTF-8"},"content":{"rendered":"<p>A lot of times, I find myself creating output files in Windows that I want to use linux to parse because I am more comfortable scripting in linux than in Windows.  Most times I the output UTF-16 encoded.  You can tell by using the file command.  I used this to convert a file generated in Windows 2003 server, so that I could work with it in CentOS 6.x.<\/p>\n<blockquote><p>$ file myfilename.txt<br \/>\nmyfilename.txt: Little-endian UTF-16 Unicode text, with CRLF line terminators<\/p><\/blockquote>\n<p>Then, to convert the file:<\/p>\n<blockquote><p>$ iconv -f utf-16 -t utf-8 myfilename.txt > mynewfilename.txt<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>A lot of times, I find myself creating output files in Windows that I want to use linux to parse because I am more comfortable scripting in linux than in Windows. Most times I the output UTF-16 encoded. You can tell by using the file command. I used this to convert a file generated in [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[315,48,314,36],"class_list":["post-893","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-file-conversion","tag-linux","tag-utf","tag-windows"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=893"}],"version-history":[{"count":8,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/893\/revisions"}],"predecessor-version":[{"id":906,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/893\/revisions\/906"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}