After transfer to another server files have strange characters in their names

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

or

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 over time on the website, which after a transfer stop showing on the website's pages.

To resolve this problem you must 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:

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

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

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

Then to convert the files execute this command:

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.

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

You can modify the file via SSH, FTP or cPanel -> File Manager.

You find this article useful? Click here to learn more about SiteGround web hosting experts and what else we can do for you!