Home
/
Website Help
/
Transfer Site
/
Why my files have strange characters in their names after server transfer?

Why my files have strange characters in their names after server transfer?

In some cases after transferring files to different servers, you may start seeing their file names with strange characters:

������_����.txt

or

342325341342336322_344320331333.txt

This means that the files are not in UTF-8 and in most of the cases these files cannot be used by your website and will produce a 404 error if you try to access them. Usually, these are the images uploaded on the website, which after a transfer stop showing on the website’s pages.

To resolve this problem, convert the files to UTF-8. To do that you must first find their current encoding.

Log in your account via SSH and navigate to the folder where the files are located and then run the following command:

file -i *

This will list all files in the current directory and show their encoding, for example:

username@server [~/public_html]# file -i *
������_����.txt:        text/plain; charset=iso-8859-5

The value of the charset parameter is the current encoding of the files. In this case, it is iso-8859-5.

If you cannot see the files with their proper names while logged in your account via SSH, add the following lines in the ~/.bashrc file:

export LC_CTYPE=en_US.UTF-8

To modify the file use SSH, FTP or Site Tools > Site > File Manager.

Now that you know the exact encoding the files are using, convert them to UTF-8 using the convmv utility. First, you must download and extract it by using this command:

wget https://www.j3e.de/linux/convmv/convmv-2.01.tar.gz; tar -xzf convmv-2.01.tar.gz

Then to convert the files execute this command:

./convmv-2.01/convmv --notest -r -f iso-8859-5 -t UTF-8 .

Note that in the command you should replace iso-8859-5 with the exact encoding of your files. The above command will convert every file in the current directory and in all subfolders to UTF-8 and the files should start showing with their proper names and you should be able to use them on your website. Always make sure to have backups of the files on your account in case something goes wrong during the conversion.

Share This Article