Can't open file if the folder is using a odd letter

Hi,

When I try to open a office-document, e.g. spreadsheet, I get the following error message:

/home/brahmavihara/Documents/lönekonto/october.xlsx does not exist.

The document “october.xlsx” is in a folder called

lönekonto

. But, as you can see in the above quote, the error message has has a different name for the folder

lönekonto

So when I rename the folder from “lönekonto” to “lonekonto”, I can then open the file. It seems as if there’s a bug with handling international characters.

Is this a opensuse bug or a upstream bug? Where should I file the bug?

You do not tell how youy “try to open” it, this below is a bit vague also.

It looks as if some component does not handle the file name as UTF-8 encoded Unicode. When you do not have any problems in using it with e.g. your file manager (Dolphin or friends), the I would suggest that it is in openOffice (BTW do you still use openenOffice, not LibreOffice?)

I just click on the file in Dolphin. That’s when I get the error message. I have LibreOffice as default, so I suppose the message is from LibreOffice. I’ve also tried to open the file with Calligra. Both of them can’t open the file, unless I rename the folder from “lönekonto” to “lonekonto”.

You have now remaned the directory. Can you rename it back and does that re=create the proble? When yes, how do you rename the directory?

What does

ls -ld path-to/lönekonto

show? (where path-to is of course to be replaced by the path to that directory).
When that failes, try

ls -ld path-to/*konto

Another question. Is that directory (and it’s contents) on a normal Linux file system?

As hcvv suggests,
Try invoking from command line.
Recommend trying something like

For a text file, the following creates a new text file in your home directory and saves it

vi /home/lönekonto/Documents/test.txt


Press the “I” key to insert new text
Type something.
Close and save with

ESC
CTLx

The above tests for character support at the system level.
If the above works, then you should check for support in your installed Desktop.
If you don’t know how to do this, you need to post what Desktop you have installed.

TSU

Yes, when I rename it back, it recreates the problem. I renamed it by right clicking on the folder and then “rename”.

Both of the above commands return

"ls:cannot access /home/user1/lönekonto: No such file or directory

Yes, I went with the default suggested file system when I installed tumbleweed.

When I try to save and exit with ESC and CTLx (after having inserted text), I get:

"/home/user1/lönekonto/test.text" E212: Can't open file for writing

Hm, strange.

BTW, it is better to post the complete thing, that is prompt, command, output and next prompt then to say “the command returns”. Then there is no misunderstanding whatsoever about where you are, who you are, what you get.

On my 13.1 I created a directory with that name and put a JPG file in in:

henk@boven:~/test> l lönekonto/
totaal 164
drwxr-xr-x  2 henk wij   4096 16 jan 18:25 ./
drwxr-xr-x 17 henk wij   4096 16 jan 18:23 ../
-rw-r--r--  1 henk wij 157943 16 jan 18:25 verf.jpeg
henk@boven:~/test> vi lönekonto/tekst
henk@boven:~/test> l lönekonto/
totaal 168
drwxr-xr-x  2 henk wij   4096 17 jan 12:09 ./
drwxr-xr-x 17 henk wij   4096 16 jan 18:23 ../
-rw-r--r--  1 henk wij      7 17 jan 12:09 tekst
-rw-r--r--  1 henk wij 157943 16 jan 18:25 verf.jpeg
henk@boven:~/test> 

No problems with vi (you see I entered 7 characters in that file). And also no problems surfing to it with Dolphin and clicking on verf.jpeg opens it in Gwenview.

Thuis I can nor replicate your situation :frowning:

Can you post the ouput of

ls /home/user1 | grep konto | od -x

I did some investigation on what it should be. See: http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=ö&mode=char

The statement I asked you to execute on my system:

henk@boven:~/test> ls | grep konto | od -x
0000000 c36c 6eb6 6b65 6e6f 6f74 000a
0000013
henk@boven:~/test>

Because of the endianness of the system, every pair of hex bytes must be switched. Thus the first character is 6c, which is l.
The second and third byte here (I coloured them red) are b6 c3, which is what you see in the tabel in the link.

What you also see in the tabel is the same characters à ¶ that you see. Thus the filename itself is correct encoded This means that the UTF-8 encoding is not used at some moment and instead the program tries/uses Latin-1.

How is you environment ariable LANG set?

echo $LANG

I did the following:


brahmavihara@linux-0xse:~> echo $LANG
C.UTF-8
brahmavihara@linux-0xse:~> ls | grep konto | od -x
0000000 c36c 6eb6 6b65 6e6f 6f74 000a
0000013

I also tried to browse to the folder from the command line:


brahmavihara@linux-0xse:~> ls
Desktop    Downloads     Music        Pictures  Temp         bin         public_html
Databases.db                Documents  Folder views  Public    Templates  Videos     l??nekonto  rpmbuild
brahmavihara@linux-0xse:~> cd l??nekonto
brahmavihara@linux-0xse:~/lönekonto> ls
ls: reading directory .: Structure needs cleaning

Is that of any help?

From my system:

henk@boven:~/test> LANG=C.UTF-8 ls
bestanden  file        oo       ps  red     spsp    stdout  t-chown  urlmetraar  ??????????????????
ctest      l??nekonto  plaatje  py  sparkz  stderr  sw      unicode  wdir
henk@boven:~/test> ls
bestanden  file       oo       ps  red     spsp    stdout  t-chown  urlmetraar  नमस्ते
ctest      lönekonto  plaatje  py  sparkz  stderr  sw      unicode  wdir
henk@boven:~/test>

Thus the C seems to be the culprit.

Can you try with:

LANG=en_US ls

Sorry, that should be

LANG=en_US.UTF-8 ls

Here goes:


brahmavihara@linux-0xse:~> ls
Databases.db  Desktop  Documents  Downloads  Folder views  Music  Pictures  Public  Temp  Templates  Videos  bin  l??nekonto  public_html  rpmbuild
brahmavihara@linux-0xse:~> LANG=en_US.UTF-8 ls
bin  Databases.db  Desktop  Documents  Downloads  Folder views  lönekonto  Music  Pictures  Public  public_html  rpmbuild  Temp  Templates  Videos

Between, in my previous post I mentioned that I now can’t view the contents of the folder “lönekonto” when using the ls-command. That seems to be a new problem, because I can’t see the contents even when I’m using Dolphin (which I previously could).


brahmavihara@linux-0xse:~/lönekonto> ls ls: reading directory .: Structure needs cleaning

Do you know how I can clean the structure of the folder? (I’m kind of eager to do that, because I had several files and folders in that folder that now seem to be gone).

I am hesitating to give any advice on doing things, because I am still not understanding what is wrong here.

Now whe have

  • with C it shows ? for every byte not being ASCII (or Latin-1?) (Same in my example where I have one filename in Devanagri characters).
  • with en_US.UTF-8 it shows à ¶ which is a trial to interprete as Latin-1. In my case it shows correct!
  • ls says to tidy up the directory.

As there seems to be something wrong in that directory it might be that copying all inside lönekonto to some other directory (say help), deleting the broken one and then renaming help to lönekonto. And then hoping we do not copy the problem.

I managed to save all the files in the folder to a different one. Pheww :slight_smile:

I then created a new empty folder, “lönekonto”, and tried the following:

  1. Open kwrite, write a new text file, save as “testööö.txt” in the folder “lönekonto”. I then opened the file, by clicking on it in Dolphin, and it works without a problem.

  2. I repeat the above but create the file with Calligra Words. I save the file in the folder. But when I try to open it in Dolphin by clicking on it, LibreOffice starts (because it’s my default office suite), but then quits with the error message:

/home/brahmavihara/l??nekonto/test2??????.odt does not exist.
  1. I right click on the file testööö.odt, choose “Open with → Calligra Words” from the contextual menu: → the file opens, but it is empty which it wasn’t when I created and saved it.

  2. I create a new folder without any odd letters, “TEST”. Then create two files with Calligra Words:

  • the first one I save with a file name containing no odd letters, “test.odt”.
  • the second file I save with a letter containing odd letter “testö.odt”

I can open the first file, but not the second file, by clicking on it.

  1. I rename a png-file from “screenshot.png” to “screenshöt.png”, and then try to open by clicking on it in dolphin: → Gwenview responds with an error message:
The file or folder /home/brahmavihara/lönekonto does not exist.

So in summary:

  • text file created by kwrite, function normally. I can save and open them no matter the name of the folder or file.
  • libreoffice, calligra and gwenview, can’t open the file if:
    – the folder name contains an odd letter (e.g. Ö)
    – the file name contains an odd letter

Any ideas on what to do, try?

I amnot sure why your LANG i C.UTF-8.
When you install the system English (US) is the default for the system. This seems to result in LANG-POSIX (that is when I login in konsole as root).

For my user henk I have in .profile:

henk@boven:~> grep LANG .profile
#export LANG=de_DE.UTF-8        # uncomment this line for German output
#export LANG=fr_FR.UTF-8        # uncomment this line for French output
#export LANG=es_ES.UTF-8        # uncomment this line for Spanish output
export LANG=nl_NL.UTF-8 # uncomment this line for Dutch output
henk@boven:~>

What is in your .profile and can you change that in e.g. en_US.UTF-8 (or your own wanted language).

You need to logout/login after the change.

I got the following:


brahmavihara@linux-0xse:~> grep LANG .profile
# in the variable RC_LANG.
#export LANG=de_DE.UTF-8        # uncomment this line for German output
#export LANG=fr_FR.UTF-8        # uncomment this line for French output
#export LANG=es_ES.UTF-8        # uncomment this line for Spanish output

So I guess I need to add a line for the wanted language (in my case Swedish). How do I do that? Is there a command, or can I do it from a gui-front end?

As it seems you never took the trouble to change your user’s environment to Swedish, you could first, to keep it simple try English, to get rid of that C.

Edit .profile, go to where the other lines are and add

export LANG=en_US.UTF-8

Log out/in and test your problem, creating lönekonto (or a similar test dir), etc.


For later:

I assume for Swedish you have to alter that to

sv_SE.UTF-8

But for a better Swedish experience additionaly you better install from YaST > Software > Software Mangement and then using the View menu: Languages. Scroll down to your language and select for installation. That will bring you a lot of messages output by applications when they find LANG-sv_SE.UTF-8.

Also in your KDE Settings there is a languages/region entry where you can set your preferences.

Yes, problem solved rotfl! I got it working by adding the “…en_US.UTF-8”-code that you wrote above. Thank you!!

But I seem to have another problem. Previously, I mentioned that I cannot read the contents of the folder “lönekonto” from Dolphin. And when I tried to read the contents of the folder from console, I got:


brahmavihara@linux-0xse:~/lönekonto> ls 
ls: reading directory .: Structure needs cleaning

I saved the files to a new folder, by using my previous snapshot with kernel 4.3.3 (before I upgraded to 4.4.0). I can now read the contents in the new folder with Dolpin and from the console.

Now, the same problem has occurred with another folder.


brahmavihara@linux-0xse:~/Documents/Mat> ls
ls: reading directory .: Structure needs cleaning

I could copy the files from the folder by using a previous snapshot (like I did with “lönekonto”), and then delete the faulty folder. But what if it occurs again with a new folder.

Any ideas what I could try?

Should I start a new thread, or continue discussing it in this thread?

Nice it works.

About the “needs cleaning”, I have no idea. But I think a new thread with something like “What means Structure needs cleaning in an ls of a directory” or the like might be better in drawing attention.