<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tolga.kaprol.net &#187; dil kodlaması</title>
	<atom:link href="http://tolga.kaprol.net/tag/dil-kodlamasi/feed/" rel="self" type="application/rss+xml" />
	<link>http://tolga.kaprol.net</link>
	<description>Resmi Blogum</description>
	<lastBuildDate>Wed, 24 Feb 2010 10:51:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux Sistemlerde Dosyaların Encoding&#8217;lerinin Değiştirilmesi</title>
		<link>http://tolga.kaprol.net/2009/12/linux-sistemlerde-dosyalarin-encodinglerinin-degistirilmesi/</link>
		<comments>http://tolga.kaprol.net/2009/12/linux-sistemlerde-dosyalarin-encodinglerinin-degistirilmesi/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 12:28:00 +0000</pubDate>
		<dc:creator>Tolga Kaprol</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dil kodlaması]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[file encoding]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://tolga.kaprol.net/?p=46</guid>
		<description><![CDATA[Özellikle Windows ortamında oluşturulan dosyalar genellikle Windows Türkçe ya da ISO-8859-9 formatında kodlanmış oluyorlar. Ancak çoklu dil aileleriyle çalışmaya başladığınızda bunun bir kabusa dönüştüğünü farketmek zor değil. Linux&#8217;da kısa yoldan bir dosyanın encode&#8217;unu değiştirmek için;

tcs -f 8859-9 -t utf dosyaadi.php &#62; yenidosyaadi.php

komutu yeterli oluyor. Tcs direkt olarak çeviri yaptığı için içeriğini yeni bir dosya olarak [...]]]></description>
			<content:encoded><![CDATA[<p>Özellikle Windows ortamında oluşturulan dosyalar genellikle Windows Türkçe ya da ISO-8859-9 formatında kodlanmış oluyorlar. Ancak çoklu dil aileleriyle çalışmaya başladığınızda bunun bir kabusa dönüştüğünü farketmek zor değil. Linux&#8217;da kısa yoldan bir dosyanın encode&#8217;unu değiştirmek için;</p>
<blockquote>
<p style="padding-left: 30px;"><strong>tcs -f 8859-9 -t utf dosyaadi.php &gt; yenidosyaadi.php</strong></p>
</blockquote>
<p>komutu yeterli oluyor. Tcs direkt olarak çeviri yaptığı için içeriğini yeni bir dosya olarak kaydedebiliyoruz.</p>
<p>Bu işlemi otomatikleştirmek için şöyle bir script yazdık. Bu script sayesinde bir klasör içindeki bütün önemli uzantılara sahip dosyaların encodingini utf-8&#8242;e çevirebilirsiniz.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">#!/bin/sh</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">CMDLN_ARGS=&#8221;$@&#8221; # Command line arguments for this script</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">export CMDLN_ARGS</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"># Run this script as root if not already.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">chk_root () {</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if [ ! $( id -u ) -eq 0 ]; then</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">echo &#8220;Please enter your password.&#8221;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">exec sudo su -c &#8220;${0} ${CMDLN_ARGS}&#8221; # Call this prog as root</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">exit ${?}  # sice we&#8217;re &#8216;execing&#8217; above, we wont reach this exit</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"># unless something goes wrong.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">fi</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">chk_root</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">files=`find $1 -regex &#8220;.*\(php\|html\|tpl\|js\|css\|htm\)$&#8221;`</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">suffix=`eval date +%s`</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">tar -zcvf backup-$suffix.tar.gz &#8211;exclude=&#8217;*.tar.gz&#8217; $1</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">for xx in $files</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">do</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">mv $xx $xx.bak</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">echo backup to: $xx.bak</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">tcs -f 8859-9 -t utf $xx.bak &gt; $xx</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">rm $xx.bak</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">echo $xx converted</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 82px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">done</div>
<blockquote><p>#!/bin/sh</p>
<p>CMDLN_ARGS=&#8221;$@&#8221; # Command line arguments for this script</p>
<p>export CMDLN_ARGS</p>
<p># Run this script as root if not already.</p>
<p>chk_root () {</p>
<p>if [ ! $( id -u ) -eq 0 ]; then</p>
<p>echo &#8220;Please enter your password.&#8221;</p>
<p>exec sudo su -c &#8220;${0} ${CMDLN_ARGS}&#8221; # Call this prog as root</p>
<p>exit ${?}  # sice we&#8217;re &#8216;execing&#8217; above, we wont reach this exit</p>
<p># unless something goes wrong.</p>
<p>fi</p>
<p>}</p>
<p>chk_root</p>
<p>files=`find $1 -regex &#8220;.*\(php\|html\|tpl\|js\|css\|htm\)$&#8221;`</p>
<p>suffix=`eval date +%s`</p>
<p>tar -zcvf backup-$suffix.tar.gz &#8211;exclude=&#8217;*.tar.gz&#8217; $1</p>
<p>for xx in $files</p>
<p>do</p>
<p>mv $xx $xx.bak</p>
<p>echo backup to: $xx.bak</p>
<p>tcs -f 8859-9 -t utf $xx.bak &gt; $xx</p>
<p>rm $xx.bak</p>
<p>echo $xx converted</p>
<p>done</p></blockquote>
<div>Yukarıdaki kodu convertfiles olarak kaydettikten sonra <strong>chmod +x convertfiles </strong>ile çalıştırılabilir hale getirilmesi gerekir.</div>
<div>Bu komuttan sonra ./convertfiles &lt;KLASÖR ADI&gt; komutu ile istediğiniz klasörün içindeki php, html, js vb. dosyaların encodingi iso-8859-9&#8242;den UTF-8&#8242;e dönüşmüş olacaktır.</div>
<div><strong>Not: </strong>ek olarak bulunduğu klasör içine proje dosyalarını da yedeklemektedir.</div>
<div><strong>Not 2: </strong>İşleme başlamadan önce tüm dosyalarınızı manuel olarak yedeklemenizi tavsiye ederiz.</div>
]]></content:encoded>
			<wfw:commentRss>http://tolga.kaprol.net/2009/12/linux-sistemlerde-dosyalarin-encodinglerinin-degistirilmesi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
