May
28
2009

First blog - Setup

Here it comes, my first blog.
I started by setting up a simple WordPress site and changed from the default theme, it’s looking really nice.

In the future I will post some articles where I cover some problems and hopefully the solution.
I’m interested in some programming languages such as C#, Java and scripting languages such as PHP and Bash shell scripting.
I will also post some OS based problems  for I am constantly learning.

I want to use my first post to share a little shell script I used while setting up the site.

The problem:
When I set up websites I want all .php files to be saved as UTF-8 (for the special characters, since I’m located on Iceland).
what I uploaded on my server was not UTF-8, so what I needed was a script to recursively go through all folders within the website and convert all .php files to UTF-8.

The solution:
Created a executable file containing following lines.

#/bin/bash
LIST=`ls -R *.php`
for i in $LIST;
do iconv -f cp1251 -t utf8 $i -o $i.”utf8″;
mv $i.”utf8″ $i;
done 

It’s a simple script that lists all .php files and linearly converts the file to UTF-8

 
Powered by Wordpress and MySQL. Theme by openark.org