in centOS 5.6, i need to recursively rename a series of files in /path.
the files that need to be renamed contain groups of special characters in lieu of accented chars. i mapped out the table for conversion here. (What kind of encoding was used here anyways?)
i have a guess that perl would be best choice for the task, but it could also be php/python/sh开发者_Python百科ell. would someone be kind enough to help me with such script?
thanks in advance for any help.
That's mis-encoded UTF-8. Use convmv
for that.
>>> print u'Ó'.encode('cp1252').decode('utf-8').encode('cp1252').decode('utf-8')
Ó
$ convmv --nosmart -f utf-8 -t cp1252 Ó
Starting a dry run without changes...
mv "./Ó" "./Ó"
Ó exists and differs or --replace option missing - skipped
No changes to your files done. Use --notest to finally rename the files.
$ convmv --nosmart -f utf-8 -t cp1252 Ó
Starting a dry run without changes...
mv "./Ó" "./Ó"
No changes to your files done. Use --notest to finally rename the files.
精彩评论