tetsuo13 / MediaWiki-to-DokuWiki-Importer

Convert MediaWiki to DokuWiki
31 stars 10 forks source link

Dokuwiki does not allow mutated vowels in file names #11

Closed sockenklaus closed 11 years ago

sockenklaus commented 12 years ago

When you use german mutated vowels or special characters (like () etc.) in your uploaded filenames, the converter does not convert or delete them so Dokuwiki can't use the files, because special characters and mutated vowels are not allowed in Dokuwikis media manager.

It would be great if the converter could translate mutated vowels and special characters into a format that is accepted by Dokuwiki.

tetsuo13 commented 12 years ago

I'm not familiar with this feature in MediaWiki. Can you provide some examples? Also, is there some documentation on MediaWiki and DokuWiki's sites that I can reference? The closest thing I could find was something about magic words but there was no mention about uploaded files.

sockenklaus commented 12 years ago

I hope i can explain this correctly in english:

When you upload a file to mediawiki, a filename can look like this:

äöü_(foo).jpg

"äöü" (which are german mutated vowels) as well als the brackets are totally valid characters for a filename in mediawiki.

When i use the script to import this file from mediawiki to dokuwiki, the filename is not changed. But since dokuwiki does not allow "äöü" or brackets in its uploaded filenames, it does not accept this file to be used inside the dokuwiki filemanager.

The closest dokuwiki article i found is this plugin, that is used to automatically rename invalid filenames to valid filenames in dokuwiki: https://www.dokuwiki.org/plugin:mediarename

tetsuo13 commented 12 years ago

Thank you, that's perfect. I think I have enough info to go on. The plugin is especially helpful.

sockenklaus commented 12 years ago

This pull request uses the dokuwiki function "cleanID" to generate clean target filenames while copying the files.

This is kinda quick and dirty i think, because it can overwrite existing files in the mediawiki-namespace, that have very similar names, since the cleanID function replaces most of the special characters with underscores...

Well... but it works. ;)

sockenklaus commented 11 years ago

I don't know, if you noticed, but there is still code attached to this issue, that might help the project. :)

tetsuo13 commented 11 years ago

I'd like to implement #16 first before completing this issue.

tetsuo13 commented 11 years ago

I went with the change you made that uses cleanId() since it'll resolve most cases. If it's not enough then the mediarename plugin may address any issues with filename collisions.

Thank you for your help.