Novell is now a part of Micro Focus

Converting filenames to UTF-8 encoding

Novell Cool Solutions: Question & Answer

Posted: 19 Jul 2004

I just upgraded to SUSE Linux version 9.1 and some of my file names are broken now (ones that used special characters). Can you tell me an easy way to convert my file names to UTF-8 Encoding?

Yes, as you discovered, as of SUSE Linux version 9.1, the default system charset is "lang_LANG.UTF-8". There are several approaches for the conversion to UTF-8 encoding:

If you have problems concerning the incorrect representation of file names, you can use the script "convmv" to convert these names to UTF-8. For example:

convmv --notest -r -f latin1 -t utf-8

If you have problems concerning the incorrect representation of file contents, you can use the command "iconv" for their conversion to UTF-8. For example:

iconv -f latin1 -t utf-8 document.txt >> document_new.txt

If you want to switch back to the ISO encoding, open the "Language selection" module in the "System" section in "YaST Control Center". The language currently in use is preselected after launching the module. Click on "Details" and disable the use of UTF-8 encoding in the displayed dialog. Accept the modified settings and finish YaST.

The release notes for SUSE Linux version 9.1 include a section on this subject: UTF-8 Encoding Is Default

Non-UTF-8 File Names

Files from file systems created with SUSE Linux versions up to 9.0 do not use UTF-8 encoding for the file names (unless otherwise specified). If these files include non-ASCII characters, they will not be properly displayed with SUSE Linux 9.1 or newer versions. To avoid this, use the script convmv to convert the files to UTF-8.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates