I have a old pc that is running Debian stable, that is in need of a upgrade. The problem is that it is using latin1 (ISO-8859-1) for everything, and since the rest of the world has moved to UTF-8 I plan to convert this computer as well.
And for this question I will focus in on the files that are served with Samba, and some has some latin1 characters in the filenames (like åäö).
Now my plan is to move all data of this old computer onto and a brand new one that is running Debian stable (but with UTF-8).
Does anybody have a good idea?
Note: later I plan to use iconv
to convert the content of some files with something like this:
iconv --from-code=ISO-8859-1 --to-code=UTF-8 iso.txt > utf.txt
However I don't know of a good way to convert the filesystem it self.
Note: Normally I usally just scp
from one computer to the next,
but then I end up with latin1 characters in the utf-8 filesystem.
Update: Did a small test round with a hand full of files (with funny chars) in the filenames, and that seemed like it could work.
convmv -r -f ISO-8859-1 -t UTF-8 *
Note: -r
= recursive; -f
/-t
= from/to.
So it was only to execute with the --notest
convmv -r -f ISO-8859-1 -t UTF-8 --notest *
Nothing more to it.
Use convmv:
apt-get install convmv
:-)
Note for readers who come across this page before they transferred the files:
you can do the transfer with a recent rsync and the --iconv option:
(yes, the ordering of the iconv charsets is not intuitive!)
For when the transfer has already been done, indeed convmv is the solution.
There is an Unicode Char Encoding Converter that supports character encoding conversion between Unicode(UTF-8/UTF-16/UTF-7/UTF-32) and non Unicode(Ansi,Chinese simplified GBK, Chinese traditional BIG5, Japanese SHIFT-JIS, Japanese EUC-JP, Korean euc-kr characters set encoding etc).
Execute this in the current directory:
I would test first if the file isn't in the target codification, otherwise you can mess up your files, I guess. (the example below to zsh) you can adapt the code and put it inside a "for" loop.