
changeFilenameCode
Source (link to git-repo or to original if based on someone elses unmodified work):
Description:
Service menu to convert filenames from and to utf-8
***
When you have files named with special characters as é è à ô etc. and a system using utf-8 you may have some problems. Old files created before your utf-8 system or files comming from windows may be encoded using iso-XXX charater set. So they will be badly displayed ! (usualy a square in place of character)
This service menu is designed to repair that by converting your filenames to and from utf-8.
***
Requirement:
- iconv : http://www.gnu.org/software/libiconv/
- bash : http://www.gnu.org/software/bash/
***
Install:
- extract files
- copy the encodeRename.sh bash script somewhere in your PATH
(make sure it is executable)
- copy the changeFilenameCode.desktop to
- ~/.kde/share/apps/konqueror/servicemenus/ for only one user
- /usr/share/apps/konqueror/servicemenus/ (as root) for all users
- edit changeFilenameCode.desktop to set up your code
ie: replace iso-8859-1 which is code for French characters
- restart konqueror
***
Author: JJL
Home Page: http://kubuntu.free.fr/servicemenu/ Last changelog:
***
When you have files named with special characters as é è à ô etc. and a system using utf-8 you may have some problems. Old files created before your utf-8 system or files comming from windows may be encoded using iso-XXX charater set. So they will be badly displayed ! (usualy a square in place of character)
This service menu is designed to repair that by converting your filenames to and from utf-8.
***
Requirement:
- iconv : http://www.gnu.org/software/libiconv/
- bash : http://www.gnu.org/software/bash/
***
Install:
- extract files
- copy the encodeRename.sh bash script somewhere in your PATH
(make sure it is executable)
- copy the changeFilenameCode.desktop to
- ~/.kde/share/apps/konqueror/servicemenus/ for only one user
- /usr/share/apps/konqueror/servicemenus/ (as root) for all users
- edit changeFilenameCode.desktop to set up your code
ie: replace iso-8859-1 which is code for French characters
- restart konqueror
***
Author: JJL
Home Page: http://kubuntu.free.fr/servicemenu/
0.2 02/11/2005 add french translation
also works for directories (thanks to bobuse)
0.1 23/10/2005 first release
Ratings & Comments
11 Comments
Why not use the convmv utility instead of a hand-grown script that does only half of the job? Instead of this script one could just install convmv and run it once and be done with it. -> bad.
Hi I've discovered the tool convmv, that do the job of your shell script. This tool could too act recursively :-) I've created another servicemenu : http://www.kde-apps.org/content/show.php?content=31400
Hi!! Your tool is nice. I have a suggestion: It would be nice to be able to convert filenames recursively (automatically going into directories). Ideally that could be done with an extra "-r" option for the encodeRename.sh script. (and is not really needed inside the servicemenu entry). Thanks!!
Thanks for your comment. I will look at such an option but this should complicate the script a bit :) Anyway you could do that with a find command (from iso-8859-1 to utf-8) : find . -type f -execdir encodeRename.sh iso-8859-1 utf-8 {} \; (This works only for files)
Thank's. This is a very useful Service Menu addon.
add an option to convert the content of the file...
Why enable this servicemenu only for files ? Rename directory could be usefull. Just replace all/allfiles by all/all in changeFilenameCode.desktop
In addition the script "encodeRename.sh" need a modification. Just before the last instruction (mv), insert "[ -d $old ] && cd .."
Yes, that's a good idea (up to now I've only had the problem on files). I've done new version including directories. Thanks
which one? there is more than one (ISO8859-1, ISO8859-2, 3, 4..)
Default value is ISO-8859-1. To change it, juste edit the changeFilenameCode.desktop file and replace iso-8859-1 (on the 2 Exec lines) by your needed code. You can use any code supported by iconv.