Bug 158639

Summary: SMB KIO can't work with non-ascii file names
Product: [Frameworks and Libraries] kio Reporter: Bruno Laturner <renrutal>
Component: smbAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: akarako, anarchic.teapot, andresbajotierra, bernt.lindhe, bjoern, deolivec, finex, francois.tissandier, jorortega, killgore, lukas, mail.regs, mail4cyb, mecirt, nt1277, rdieter, rion, sts, sven.burmeister, victorjss, vitruss
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 173778    
Attachments: konqueror error when utf-8 character present in file or directory name
Make smb work correctly with files with utf8 characters in its name

Description Bruno Laturner 2008-03-01 21:14:48 UTC
Version:           unknown (using 4.0.1 (KDE 4.0.1), Gentoo)
Compiler:          i686-pc-linux-gnu-gcc
OS:                Linux (i686) release 2.6.23-gentoo-r5

When opening the folder smb://ichi/SharedDocs/ it will display the following error:

File does not exist: smb://ichi/SharedDocs/Meus%20v%C3%ADdeos

when trying to display the folder 'Meus Vídeos'. Its file type will remain as 'unknown'.

The same happens to another folder, 'Minhas Músicas'. But the error box won't happen, just the other effects (unknown).

These names remain displayed correctly within the folder.
---

When creating a file named 'Tést' in that SharedDocs folder, it will display the same first error as before, because 'Meus Vídeos' < 'Tést'. However, the file is being displayed as 'T?st', the ? being a weird white-on-black ? symbol.

I cannot delete that newly created file.

All the operations described above can be done correctly in my home folder in this machine. This is a LC_ALL=pt_BR.UTF-8 system.

The 'ichi' host is a Windows XP Home.
Comment 1 Stephan Kulow 2008-03-02 12:15:42 UTC
I'm afraid your XP does not run in unicode mode. Or it does and your gentoo doesn't.
Comment 2 Bruno Laturner 2008-03-03 13:41:09 UTC
I will consult this downstream with the Gentoo devs.
Comment 3 Bruno Laturner 2008-03-04 01:57:48 UTC
Forcing the mount in utf8 with

smbmount //ICHI/SharedDocs samba -o iocharset=utf8

does work correctly. Browsing that mount with Dolphin works as expected.
Mounting w/o the iocharset flag displays the wrong charset.

Bug downstream:

http://bugs.gentoo.org/show_bug.cgi?id=212235
Comment 4 Rion 2008-04-22 16:56:26 UTC
i can confirm it but...

i can't see directories with non-latin characters in name at all
i see simple files with non-latin characters but can't open/copy them (file not found)

also i use fusesmb and it works perfect without any settings
Comment 5 Bruno Laturner 2008-05-31 16:58:17 UTC
Update:

Version:           KDE 4.0.4, Gentoo
Compiler:          i686-pc-linux-gnu-gcc
OS:                Linux (i686) release 2.6.25-gentoo-r1

I still have the very same problems, except for the bug corrected in http://bugs.kde.org/show_bug.cgi?id=155689

In this same machine, I loaded the KDE 3.5 session with this same user. It works very well, meaning it's not a Windows XP problem nor it is a Gentoo problem (at least with 3.5).

If this is indeed a Gentoo/configuration problem with 4.0, may anyone suggest a fix?
Comment 6 Pino Toscano 2008-06-25 10:12:40 UTC
*** Bug 164498 has been marked as a duplicate of this bug. ***
Comment 7 Pino Toscano 2008-06-25 10:12:43 UTC
*** Bug 164897 has been marked as a duplicate of this bug. ***
Comment 8 fro.zie 2008-06-28 16:32:27 UTC
*** This bug has been confirmed by popular vote. ***
Comment 9 Pino Toscano 2008-06-30 14:25:16 UTC
*** Bug 165399 has been marked as a duplicate of this bug. ***
Comment 10 Pino Toscano 2008-06-30 14:25:50 UTC
*** Bug 136996 has been marked as a duplicate of this bug. ***
Comment 11 Frank Sagurna 2008-07-28 14:30:13 UTC
I have this problem here on my Ubuntu machines, running KDE 4.1 so it is not special for Gentoo.
Server is Ubuntu Hardy, and so is client (Both use the stock samba packages).
I also have a problem with spaces in Filenames over fish (ssh) protocol in konqueror KDE4 and dolphin KDE4. Konqueror of KDE3 is working correctly.
Comment 12 Gustavo A. Díaz 2008-07-30 19:55:20 UTC
Same problems here.. and since 4.0.x, all alphas and betas of kde4.1 and even in the last 4.1 stable version.
Dolphin and Konqueror refuses to show folders and files with non ascii characters using smb protocol.

Note: I am using Kubuntu Hardy.
Comment 13 Diederik van der Boor 2008-08-03 15:53:58 UTC
I have the same issue with 4.1 in openSUSE. I couldn't copy music of the artist 'Bløf' from the other machine.
Comment 14 Detlef Bloch 2008-08-05 17:40:41 UTC
Created attachment 26655 [details]
konqueror error when utf-8 character present in file or directory name

Similar problem with nfs:

A nfs server is setup with ubuntu 8.04 server, but the client on opensuse 11.0
and kde 3.5 creates a konqueror error when trying to access a remote directory
"Dia Scans" because a subdirectory "Old Brüssel Scans" - with u-umlaut- is
present. Konqueror does not display any file/directory info after the error is
raised. Strange enough the second "/" in 192.168.1.13/mnt%252fraid3 is not
accepted but displayed as %252f.

See attached screenshot.
Comment 15 Björn Ruberg 2008-09-21 18:42:46 UTC
Created attachment 27502 [details]
Make smb work correctly with files with utf8 characters in its name

I have made a patch for this. Kind of simple bug. Internally the url is converted to latin1, which drops utf8 characters. 
This patch fixes that. Should be something for 4.1.2
Comment 16 Bruno Laturner 2008-09-22 05:23:53 UTC
Fix confirmed in KDE 4.1++ (KDE 4.1.67 snapshot, Gentoo kdesvn-portage overlay), no other changes required.
Comment 17 Stephan Kulow 2008-09-30 13:37:28 UTC
yeah, looks safe. I wonder though why a) this was written this way and b) left unnoticed for all of KDE3.
Comment 18 Björn Ruberg 2008-10-02 20:56:28 UTC
Is this in svn now? I'm a little upset that it probably didn't make it into 4.1.2 . My parents are shouting at me because they cannot browse the file server from the linux-laptop without error ;) 

To your questions:
That is quite old code from 2000.
a) Perhaps the libsmbclient-API changed and used latin1-filenames earlier? So perhaps someone added the utf8-conversion later and did not see the bad latin1-conversions above. You don't notice this as long as you use only ASCII-Characters
b) Perhaps the conversion-methods of QString changed their behaviour from Qt3 to Qt4?
Comment 19 sts 2008-10-17 13:15:07 UTC
*** Bug 173026 has been marked as a duplicate of this bug. ***
Comment 20 sts 2008-10-17 13:18:34 UTC
I can confirm this bug with opensuse11 samba3 server and dolphin/smb. If I create a file with german 'ü' on the server (utf-8) dolphin can't read this one.
Comment 21 FiNeX 2008-12-20 12:04:21 UTC
*** Bug 169781 has been marked as a duplicate of this bug. ***
Comment 22 FiNeX 2008-12-20 12:04:33 UTC
*** Bug 171742 has been marked as a duplicate of this bug. ***
Comment 23 FiNeX 2008-12-20 12:05:05 UTC
*** Bug 170213 has been marked as a duplicate of this bug. ***
Comment 24 FiNeX 2008-12-20 12:06:25 UTC
*** Bug 168481 has been marked as a duplicate of this bug. ***
Comment 25 FiNeX 2008-12-20 12:10:28 UTC
*** Bug 171819 has been marked as a duplicate of this bug. ***
Comment 26 FiNeX 2008-12-20 12:10:56 UTC
*** Bug 172840 has been marked as a duplicate of this bug. ***
Comment 27 FiNeX 2008-12-20 12:17:18 UTC
Using current trunk (r898537) I'm able to access on a samba share with special chars on paths and filenames.

Who can still reproduce the bug (please, try with KDE 4.2 beta2 or trunk) should provide a clear "step by step" explanation for how to reproduce it.

Thanks
Comment 28 Björn Ruberg 2009-01-03 16:18:32 UTC
Looking at the code this is fixed in 4.2 trunk. Beta2 does work for me, too.

But: Can you PLEASE backport this into KDE 4.1? My patch may be no beauty but it works. This bug is a huge problem for everyone using non-ascii characters. Nearly everyone who needs to access samba-shares in Germany for example will have it. 
I had to switch two computers to gnome just because of THIS damn and fixed(!) bug. 

I once hoped that this could be fixed in 4.1.2 . It's not in 4.1.3. So please, bring the patch into 4.1.4, so that distributions using KDE 4.1 can ship it via update.
Comment 29 Dario Andres 2009-01-07 15:52:08 UTC
*** Bug 179911 has been marked as a duplicate of this bug. ***
Comment 30 Raz 2009-01-07 18:11:17 UTC
I am now considering trying a KDE distro (Mandriva, shipping with KDE4.1.2) after a few years of ubuntu. Accessing shares is a MUST. For me this terrible bug is a definite NO to migration to a KDE distro. This NO is for two reasons:
1. (The obvious...) This is a major, not normal, functionality issue.
2. Looking at this bug's history, it seems it has been opened almost a year ago (!), has already been fixed in upcoming beta versions, but still not yet back-ported to be incorporated in the distros on the market! In my opinion this is very amature, and a poor demonstration of capabilities by the KDE community, reducing my expectations for support in other issues that will arise along the way.
Come on, people! wake up! Most of the world uses special characters, and KDE4 is not at all being happily accepted! What are you waiting for? For KDE to be completely shunned?!
Comment 31 Victor Suarez 2009-01-07 21:03:29 UTC
I have opened the duplicated Bug 170213 when I was running Kubuntu 8.04 (64 bits). Kubuntu 8.10 (64 bits) corrected this issue, so I think it is more a distribution problem than a KDE issue.

Now it is working on Samba shares and Windows XP shares. 
Comment 32 cesar 2009-01-08 09:20:50 UTC
I'm not sure that this issue is a distribution problem because I see it on two recent distros :
*OPENSuse 11.1
*Mandriva 2009

Maybe, Kubuntu has patched KDE to avoid this issue...
Comment 33 Tommi Tervo 2009-01-08 10:03:51 UTC
Ubuntu has patched this indeed, a bit different way.
KDE 4.1.4 is already tagged so it may be too late to get this patch to 4.1.4

http://archive.ubuntu.com/ubuntu/pool/main/k/kdebase-runtime/kdebase-runtime_4.1.2-0ubuntu6.diff.gz

kdebase-runtime (4:4.1.2-0ubuntu4) intrepid; urgency=low

  * Add kubuntu_04_kiosmb.diff from trunk, fixes smb access

 -- Jonathan Riddell <jriddell@ubuntu.com>  Tue, 14 Oct 2008 10:59:43 +0100

+diff -urN kdebase-runtime-4.1.2/kioslave/smb/kio_smb_internal.cpp ../kdebase-runtime-4.1.2/kioslave/smb/kio_smb_internal.cpp
+--- kdebase-runtime-4.1.2/kioslave/smb/kio_smb_internal.cpp    2008-04-18 08:21:42.000000000 +0100
++++ kdebase-runtime-4.1.2/kioslave/smb/kio_smb_internal.cpp    2008-10-14 10:50:25.000000000 +0100
+@@ -80,21 +80,12 @@
+
+     // SMB URLs are UTF-8 encoded
+     kDebug(KIO_SMB) << "updateCache " << KUrl::path();
+-    if (KUrl::url() == "smb:/")
+-        m_surl = "smb://";
+-    else {
+-        QString surl = "smb://";
+-        if (KUrl::hasUser()) {
+-            surl += QUrl::fromPercentEncoding(KUrl::user().toLatin1());
+-            if (KUrl::hasPass()) {
+-                surl += ':' + QUrl::fromPercentEncoding(KUrl::pass().toLatin1());
+-            }
+-            surl += '@';
+-        }
+-        surl += QUrl::fromPercentEncoding(KUrl::host().toUpper().toLatin1());
+-        surl += QUrl::fromPercentEncoding(KUrl::path().toLatin1());
+-        m_surl = surl.toUtf8();
+-    }
++
++    if ( KUrl::url() == "smb:/" )
++      m_surl = "smb://";
++    else
++      m_surl = KUrl::url( RemoveTrailingSlash ).toUtf8();
++
+     m_type = SMBURLTYPE_UNKNOWN;
+     // update m_type
+     (void)getType();
Comment 34 Chris 2009-01-08 15:19:27 UTC
I have the same problem with OpenSuse 11.1. Whenever I try to acces samba share with polish characters like ą,ę etc I get "process for the protocol smb://server/share stopped unexpectedly". Mounting with utf8 helps.
Comment 35 Tamás Németh 2009-01-14 19:01:06 UTC
I can confirm this on the 64 bit final version of openSUSE 11.1
Comment 36 S. Burmeister 2009-01-22 09:24:18 UTC
In http://bugs.kde.org/show_bug.cgi?id=165044#c34 somebody describes a very similar bug, but with sftp:/ would that also be fixed or was this fix only for smb:/?
Comment 37 cesar 2009-02-05 14:57:27 UTC
I don't want to be rude, but I think that the priority of this bug must be higher. This bug impacts almost all non english speakers...

This issue can discourage many switchers/users...
Comment 38 Tomas Mecir 2009-02-05 15:09:58 UTC
Seems to be fixed in KDE 4.2, at least I cannot reproduce anymore, so, upgrade?
Comment 39 cesar 2009-02-05 15:16:13 UTC
Great!!!! Thanks for the information. I will try it as soon as possible...

So, this bug can be closed. no?

Huge thanks to the KDE team for all their work ;-)

Comment 40 Tommi Tervo 2009-02-05 15:33:34 UTC
Fixed in 4.2. 
Comment 41 Tommi Tervo 2009-02-05 22:10:34 UTC
*** Bug 176486 has been marked as a duplicate of this bug. ***