DokuWiki nfencode converter from “url” to “utf-8”

I have used this script on my linux system without any issues. Do not use it on Windows.

Script is very simple, you can change it to recode from other encodings just by changing one line of code.

#!/usr/bin/perl -w
use strict;
use URI::Escape;

my @files;
while(my $file = <>) {
	chomp $file;
	push @files, $file;

foreach my $file (reverse @files) {
	if( $file =~ /%/ ) {
		print "$file\n";

sub convert {
	my $file = shift; # it can be directory
	die unless $file =~ /^(.*?)([^\/]+)$/;
	my $new_filename = "$1" . uri_unescape("$2");
	print "$new_filename\n";
	rename($file,$new_filename) or die;

Usage: Save it as “” to DokiWiki data/ directory, make it executable, then:

$ cd dokuwiki/data; find . | ./

Leave a Reply