Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Форуми / Cotonti / Patches / Skinvertor - encoding converter

A simple script for bulk encoding conversion

#1 16.02.2009 22:06
I've made a simple script which is useful to convert many files from one encoding to another at once. It was originally used to convert skins to UTF-8, but you can use it for other aims too.

How to use it:
1. Put it somewhere on your site (or localhost), e.g. site root
2. Edit configuration in header:
  • $source_folder - files will be collected from this path (non-recursively)
  • $target_folder - converted files will be put in this folder
  • $extensions - list of extensions for files to convert, separated with pipe (|) sign
  • $source_encoding - source encoding name, e.g. ISO-8859-1
  • $target_encoding - target encoding name, e.g. UTF-8
3. Make sure your $target_folder is writeable for the script (often means chmod 777). It is strongly recommended that $target_folder is not the same as $source_folder and is some temporary location.
4. Run http://your_site/your_folder/skinvertor.php
5. Take the converted files from $target_folder

May the Source be with you!
#2 12.03.2009 21:47
In case anyone's interested in a recursive solution that can handle batch files in different directories here's what I used

You search for the files you want to convert via total commander and then feed it to this app. Converts flawlessly, including the decoding of all HTML entities.
<a href="">Surreal Art</a>