[Solved] Problems with "ščž" characters in filenames


#1

Hi! Running unstable TrueOS-Desktop-201711140940, Lumina 1.3.3
Problem is when I try to delete certain files with š, č or ž characters in names (on FAT32 usb key). Those files have been created on Windows 7 system. Lumina File manager lists all those files in error report, if I try to delete from terminal I get this:

/.autofs/da0s1# rm -rf anab/
rm: anab/Gradbena in urbanisti?na zakonodaja-POPRAVEK.docx: Invalid argument
rm: anab/Predavanja/02_Predstavitev izbranih re?itev 1RV12-13_NET.pdf: Invalid argument
rm: anab/Predavanja/08_2_Potresna obte?ba 2015.pdf: Invalid argument                                                                                
rm: anab/Predavanja/10_1_DIASI POSLEDICE POTRESOV NA STAVBAH - SKRAJ?ANO.pdf: Invalid argument                                                      
rm: anab/Predavanja/Potresna obte?ba 2015.pdf: Invalid argument                                                                                     
rm: anab/Predavanja: Directory not empty                                                                                                            
rm: anab/: Directory not empty               

# mv Gradbena\ in\ urbanisti\?na\ zakonodaja-POPRAVEK.docx gradbenaZakonodaja.docx
mv: rename Gradbena in urbanisti?na zakonodaja-POPRAVEK.docx to zak.docx: Invalid argument


#2

can you

cd anab/Gradbena
rm -rf “urbanisti?na zakonodaja-POPRAVEK.docx”

and see what happens… Making sure you have quotes around the weird filenames.


#3

Read:
1/2
https://www.freebsd.org/cgi/man.cgi?query=encguess&manpath=FreeBSD+11.1-RELEASE+and+Ports

and
2/2
https://www.freebsd.org/cgi/man.cgi?query=mount_msdosfs&sektion=8&manpath=FreeBSD+11.1-RELEASE+and+Ports


#4

What @bsdtester obscurely means (and I agree with) is that you should mount the FAT USB device with a different locale/encoding first - it looks like the encoding used on the removable device was not properly converted to the system locale during the mounting procedures:

Example:

mkdir /tmp/MyRemovableDevice
mount_msdosfs -L [MYLOCALE] /dev/[DEVICE] /tmp/MyRemovableDevice

To unmount it when you are done:

umount /tmp/MyRemovableDevice

[DEVICE] should be something like “da0s1” (just hover your mouse over the desktop shortcut and it should show you what it is)
[LOCALE] should be something like “en_US.UTF-8”. Change this as needed for your particular Locale/encoding.


#5

That’s exactly, what I wanted to hint at. Thanks for clarification.

Another easy way to examine the unknown encoding of files could be the internal file viewer of the “Midnight Commander”: With Meta-E and/or Alt-E, You can try different encodings until the letters look like expected.

Then You’ll know, what encoding Your file is in.


#6

Thanks @beanpole135 , that solved problem! Just to confirm this is not related to Lumina I installed FreeBSD 11.1 and tested this there:

mount_msdosfs /dev/da0s1 /tmp/MyRemovableDevice
cd /tmp/MyRemovableDevice/
root@warden:/tmp/MyRemovableDevice # cd anab/
root@warden:/tmp/MyRemovableDevice/anab # ls
Gradbena in urbanisti?na zakonodaja-POPRAVEK.docx
Predavanja
root@warden:/tmp/MyRemovableDevice/anab # rm Gradbena\ in\ urbanisti\?na\ zakono                                                                             daja-POPRAVEK.docx
rm: Gradbena in urbanisti?na zakonodaja-POPRAVEK.docx: Invalid argument

If I mount witl -L I get two ?? in place of special character, but removing file works!

root@warden:~ # mount_msdosfs -L sl_SI.UTF-8 /dev/da0s1 /tmp/MyRemovableDevice
root@warden:~ # cd /tmp/
MyRemovableDevice/ screens/
root@warden:~ # cd /tmp/MyRemovableDevice/anab/
root@warden:/tmp/MyRemovableDevice/anab # ls -alh
total 64
drwxr-xr-x  1 root  wheel    16K Oct  5 18:22 .
drwxr-xr-x  1 root  wheel    16K Jan  1  1980 ..
-rwxr-xr-x  1 root  wheel    15K Jul 26 20:33 Gradbena in urbanisti??na zakonoda                                                                             ja-POPRAVEK.docx
drwxr-xr-x  1 root  wheel    16K Oct  5 18:38 Predavanja
root@warden:/tmp/MyRemovableDevice/anab # rm Gradbena\ in\ urbanisti\304\215na\                                                                              zakonodaja-POPRAVEK.docx
root@warden:/tmp/MyRemovableDevice/anab # ls -alh
total 48
drwxr-xr-x  1 root  wheel    16K Oct  5 18:22 .
drwxr-xr-x  1 root  wheel    16K Jan  1  1980 ..
drwxr-xr-x  1 root  wheel    16K Oct  5 18:38 Predavanja

Tnx for help <3


#7