2007年2月28日水曜日

XOOPSのUTF-8化

XOOPSのUTF-8化に挑戦したが挫折。
bwikiがどうにもこうにも。ファイル名が戻せないのが敗因。
取り組む余裕もないのでcubeに行く。

#! /bin/sh
test -z "$1" && echo "Usage: x2utf " && exit
nkf=/root/nkf205/nkf
user=www.psacln
cd $1
find . * -type f -name '*.php' | while read file; do mv $file $file.euc echo $file $nkf -w $file.euc > $file rm $file.euc sed -i "s/EUC-JP/UTF-8/g" $file
done
find . * -type f -name '*.txt' | while read file; do mv $file $file.euc echo $file $nkf -w $file.euc > $file rm $file.euc done
find . * -type f -name '*.tpl' | while read file; do mv $file $file.euc echo $file $nkf -w $file.euc > $file rm $file.euc done
find . * -type f -name '*.css' | while read file; do mv $file $file.euc echo $file $nkf -w $file.euc > $file rm $file.euc done
find . * -type f -name '*.html' | while read file; do mv $file $file.euc echo $file $nkf -w $file.euc > $file rm $file.euc done
find . * -type f -name '*.dat' | while read file; do
mv $file $file.euc
echo $file
$nkf -w $file.euc > $file
rm $file.euc
done
chown -R $user $1
cd $1
chmod 777 cache templates_c uploads
chmod -R 666 ./cache/* ./templates_c/* ./uploads/*
find . * -type d -name 'bwiki' | while read bwiki; do
cd $bwiki
chmod -R 777 wiki wiki.en attach backup cache counter trackback diff
cd $1
done
exit

以上、スクリプトまでUTF化するやつでした・・・。
pathはフルパスで指定しないとダメ。要nkf。

とおもったあらpukiwiki UTF8化の手法でいけるかもしれない。
http://fullmetal.dip.jp/pukiwiki/index.php?memo%2F%E6%94%B9%E9%80%A0%2FUTF-8%E5%8C%96
内容が違うので注意が必要。
あーんど
上のsh実行した後iconvで決め打ちで変換すると多分ファイルが壊れます・・・。




0 件のコメント:

コメントを投稿

フォロワー

ブログ アーカイブ