DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:convert_to_utf8

This is an old revision of the document!


Convert URL Encoded DokuWiki Filenames to UTF-8

In response to a mailing list request

urldecode.php
<?php
 
$mode = 0775;  // permissions to use for directory creation
 
$src = $argv[1];
$dst = $argv[2].'/'.urldecode($argv[1]);
 
$path = dirname($dst);
if (!file_exists($path)) {
#    echo "mkdir -p $path\n";
    mkdir($path,$mode,true);
}
 
#echo "cp $src $dst \n";
copy($src,$dst);
; run from data/pages directory
; replace {NEW} with the name of a directory to receive the copied tree 
;
for wikpage in `find . -type f -name "*.txt"` ; do php urldecode.php $wikipage {NEW} ; done

The above command is effectively cp -R ./* {NEW} where all the destination paths/filenames are urldecoded versions of the source paths/filenames.

tips/convert_to_utf8.1287163012.txt.gz · Last modified: 2010-10-15 19:16 by ChrisS

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki