DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy

tips:convert_to_utf8

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 
; ensure {NEW} isn't within data/pages :)
;
for wikipage 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.txt · Last modified: 2015-06-05 17:24 by 222.235.145.30