{"id":97,"date":"2017-07-25T16:20:11","date_gmt":"2017-07-25T15:20:11","guid":{"rendered":"http:\/\/vgdata.dk\/blog\/?p=97"},"modified":"2023-04-14T09:42:55","modified_gmt":"2023-04-14T08:42:55","slug":"iconv-your-savior-from-unicode","status":"publish","type":"post","link":"http:\/\/vgdata.dk\/blog\/?p=97","title":{"rendered":"iconv &#8211;  your savior from unicode"},"content":{"rendered":"\n<p>I never stop to be amazed of the amount of tools that you have on linux.<br>I had to compare two tables from dos, one generated from excell the other from a custom database.<br>Both were supplied as csv files.<br>I wanted to create a tool in my favorite language FPC\/Lazarus.<br>But alas, I got strange characters in the fields, just because of the Swedish letters \u00f6\u00e4\u00e5.<br>Tried to cat the files and that didn&#8217;t help.<br>Vi, of course, showed everything correct. What would you expect from the best editor in the world.<br>I determined that the issue was that the files were using unicode for &#8220;strange&#8221; characters, and linux like UTF-8.<br>Searched the net for tools in FPC to convert the strings, but didn&#8217;t find anything usefull.<br>Then I thought about finding a command line tool to convert the files before I used FPC\/Lazarus to do my stuff.<br>Lo and behold &#8211; I found iconv, already installed in my mint.<br>First I ran dos2unix to get rid of the crls sequense.<br>Then I ran iconv -f ISO8859-1 -t UTF-8 &gt; and all my problems disappeared into thin air<\/p>\n\n\n\n<p>I love linux!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I never stop to be amazed of the amount of tools that you have on linux.I had to compare two tables from dos, one generated from excell the other from a custom database.Both were supplied as csv files.I wanted to &hellip; <a href=\"http:\/\/vgdata.dk\/blog\/?p=97\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/97"}],"collection":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":3,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":186,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/186"}],"wp:attachment":[{"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/vgdata.dk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}