Bug 297529 - Konsole does not allow use of national characters in "-e" command argument
Summary: Konsole does not allow use of national characters in "-e" command argument
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.8.999
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-05 12:00 UTC by Eugene Shalygin
Modified: 2012-04-24 13:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.8.3
Sentry Crash Report:


Attachments
Proposed patch (1.09 KB, patch)
2012-04-05 12:00 UTC, Eugene Shalygin
Details
New patch (1.15 KB, patch)
2012-04-10 13:23 UTC, Kurt Hindenburg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Shalygin 2012-04-05 12:00:40 UTC
Created attachment 70174 [details]
Proposed patch

It is impossible to launch command with national charachters in path via "-e" konsole switch.

 As for me, the problem is caused by using toLatin1() in Pty::start() when invoking setProgram() and also not setting proper QTextCodec for c-strings. 

Attached patch fixes the issue but I don't know is it correct way to do that with respect to QTextCodec. Maybe QTextCodec adjusting has to be moved to KonsolePart instantiation?
Comment 1 Jekyll Wu 2012-04-09 20:51:42 UTC
Thanks for reporting and the patch. 

I think your analysis and patch is fine for stand-alone Konsole. For konsoelpart, calling QTextCodec::setCodecForCStrings() might be problematic since that would also influence the hosting appliations(?).

@Kurt, what is your idea?
Comment 2 Kurt Hindenburg 2012-04-10 03:00:50 UTC
Let me try to set this up to test it.  There's some thought using toLocal8Bit() might work.
Eugene ,what's the full command you're trying to use?
Comment 3 Jekyll Wu 2012-04-10 03:25:31 UTC
Hi Kurt:

It is not hard to setup a test

$ cd /tmp
$ cp `which vi` ./编辑器
$ konsole -e ./编辑器
Comment 4 Kurt Hindenburg 2012-04-10 13:23:24 UTC
Created attachment 70286 [details]
New patch

Can you try this?  The QTextCodec::setCodecForCStrings is not the way to do this.  Also, the encodeName() doesn't make any sense and I'm not sure why it was in there.
Comment 5 Eugene Shalygin 2012-04-10 14:33:53 UTC
(In reply to comment #4)
this patch works, thanks. I also was in doubt because of the encodeName() invocation and decided to set codec :)
Comment 6 Kurt Hindenburg 2012-04-10 15:32:32 UTC
Git commit 3ceb32461c107dd3feb315a4a4022acad72612ec by Kurt Hindenburg.
Committed on 10/04/2012 at 17:22.
Pushed by hindenburg into branch 'master'.

Allow non-English for program names; useful w/ -e

The old code used Latin1() to check program names and also used
QFile::encodeName().

Thanks to Eugene Shalygin for report and research.

Example:
cp `which vi` ./编辑器
konsole -e ./编辑器
FIXED-IN: 2.8.3

M  +1    -1    src/Pty.cpp
M  +3    -3    src/Session.cpp

http://commits.kde.org/konsole/3ceb32461c107dd3feb315a4a4022acad72612ec
Comment 7 Kurt Hindenburg 2012-04-24 13:00:14 UTC
Git commit fe726be565e3445e4cfaa6ec5eeabd1064bb280b by Kurt Hindenburg.
Committed on 24/04/2012 at 14:58.
Pushed by hindenburg into branch 'KDE/4.8'.

Allow non-English for program names; useful w/ -e

    The old code used Latin1() to check program names and also used
    QFile::encodeName().

    Thanks to Eugene Shalygin for report and research.

    Example:
    cp `which vi` ./编辑器
    konsole -e ./编辑器
    FIXED-IN: 2.8.3

cherry-picked from 3ceb32461c107dd3feb315a4a4022acad72612ec

M  +1    -1    src/Pty.cpp
M  +1    -1    src/Session.cpp

http://commits.kde.org/konsole/fe726be565e3445e4cfaa6ec5eeabd1064bb280b