Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Double click fails to open project if path contains non-ASCII characters #1995

Closed
unfa opened this issue Apr 21, 2015 · 10 comments
Closed

Comments

@unfa
Copy link
Contributor

unfa commented Apr 21, 2015

I'm nurring KX Studio, the file manager is Dolphin (KDE).

When I doubleclick on a project file, LMMS opens but shows this dialog:

lmms-doubleclick-project-load-fail

And creates new session.

Opening the same file via File>Open dialog works fine.

@tresf
Copy link
Member

tresf commented Apr 21, 2015

At a glance looks related to #1325, where the latin1 version of the text is being processed rather than the utf8, etc

@softrabbit
Copy link
Member

To rule out an oddly named folder, I'd like to see confirmation that:

  • Dolphin shows the folder name OK
  • Doubleclicking other files in the same folder works fine
  • The folder name looks OK on the command line

And, can the project be opened from the command line using its full path?

@unfa
Copy link
Contributor Author

unfa commented Apr 21, 2015

Dolphin show the file name fine.
Doubleclicking other files (WAV for example in the same dir) works.
Running from comandline:

lmms /unfa/Projects/Mieczysław Szymasiewicz/Krainy Oniryczne/Muzyka/Zona/unfa-Zona-01.mmpz

Failed

cd /unfa/Projects/Mieczysław Szymasiewicz/Krainy Oniryczne/Muzyka/Zona/
lmms ./unfa-Zona-01.mmpz

Worked

I guess the Polish diacritics like "ł" are the problem on some level.

@unfa unfa changed the title [Linux] Double click fails to open project [Linux] Double click fails to open project if path contains non-ASCII characters Apr 21, 2015
@softrabbit
Copy link
Member

I guess the Polish diacritics like "ł" are the problem on some level.

Yes, looks like QStrings constructed from char * are converted using fromAscii(). Should probably use fromLocal8Bit() instead.

@tresf
Copy link
Member

tresf commented Apr 21, 2015

Thanks for the sample text. It is being triggered here: DataFile.cpp#L126 by improper encoding of the dark L or L with stroke, i.e. ł.

Had this been a UTF8 issue, the solutions proposed seemed simple, but to my surprise, I've had no luck getting them to fix the issue.

So I dug a bit deeper and stumbled upon this.... our main constructor casts the char* to QString which may be causing it per:

The default char* => QString conversion uses Latin-1, which is not what you want for file names.

Source: http://stackoverflow.com/questions/1641994/qdir-and-qdiriterator-ignore-files-with-non-ascii-filenames

The proposal is to instead use:

QApplication app(argc, argv);

QStringList args = app.arguments();

for(...)

But this changes our main.cpp logic a bit, so it would require a bit of code refactoring.

@tresf
Copy link
Member

tresf commented Apr 21, 2015

Looks like @softrabbit and I did similar work here. I'd recommend we don't override the default encoding settings, but rather use the Qt recommended approach for reading application parameters, as if we force UTF8, we may run into issues with Windows-CP1252, etc.

-Tres

@softrabbit
Copy link
Member

The fromLocal8Bit() idea came straight from here: http://doc.qt.io/qt-5/qcoreapplication.html#arguments so it should be pretty much safe.

@tresf
Copy link
Member

tresf commented Apr 21, 2015

Good catch, that seems to work.

image

We'll need to patch it into several places due to the command line rendering, etc.

tresf added a commit to tresf/lmms that referenced this issue Apr 21, 2015
@tresf
Copy link
Member

tresf commented Apr 21, 2015

@softrabbit can you take a look at #1998 and see if I missed anything?

tresf added a commit to tresf/lmms that referenced this issue Apr 21, 2015
tresf added a commit to tresf/lmms that referenced this issue Apr 21, 2015
tresf added a commit to tresf/lmms that referenced this issue Apr 21, 2015
tresf added a commit to tresf/lmms that referenced this issue Apr 21, 2015
@tresf
Copy link
Member

tresf commented Apr 24, 2015

Closed via #1998. Added to release notes under "Fixes" section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants