DokuWiki

It's better when it's simple

User Tools

Site Tools


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

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