Project

General

Profile

Actions

Emulator Issues #10274

closed

Non-ASCII characters not accepted in command-line arguments on Windows

Added by jack980517 over 7 years ago. Updated about 7 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Current
Regression:
Yes
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
5.0-2624
Fixed in:
5.0-6012

Description

Game Name?

Fire Emblem Souen no Kiseki (ファイアーエムブレム 蒼炎の軌跡)

Game ID? (right click the game in the game list, properties, info tab)

GFEJ01

MD5 Hash? (right click the game in the game list, properties, info tab, MD5 Hash: Compute)

e8277ee53984b2820ab5c2659e194443

What's the problem? Describe what went wrong.

When passing the path (and filename) as command line argument, either with -e or not, the emulator turns all non-ASCII characters to _ and would complain that it can't find E:\fireemblem\9______.gcm, when the path is actually E:\fireemblem\9_蒼炎の軌跡.gcm. What game it is does not matter here. The problem occurs with another rom file named 10_暁の女神.wbfs too. However, loading these roms from File - Open or the list in the main window succeeds with no problems. My system is in Japanese locale and these are all Japanese characters, and therefore are contained in the CP932 character set.

What steps will reproduce the problem?

  1. Change the filename or path of the ROM to contain non-ASCII characters, such as テスト
  2. Run (for example) Dolphin.exe -e テスト.gcm or Dolphin.exe テスト.gcm
  3. Watch Dolphin complain that it can't find ___.gcm

Which versions of Dolphin did you test on? Does using an older version of Dolphin solve your issue? If yes, which versions of Dolphin used to work?

Only tested on 5.0-3667

What are your PC specifications? (CPU, GPU, Operating System, more)

Windows 7 x64 Ultimate

Is there any other relevant information? (e.g. logs, screenshots,
configuration files)

No


Related issues 1 (0 open1 closed)

Has duplicate Emulator - Emulator Issues #10437: Game ISOs whose names contain special characters no longer launch from the command line—but they do launch if opened from within DolphinDuplicate

Actions
Actions #1

Updated by jack980517 over 7 years ago

Edit: If a ROM file exist at the "non-ASCII-characters-turned-to-underline" path (e.g. 9______.gcm actually exists alongside 9_蒼炎の軌跡.gcm), Dolphin would load that ROM instead without problems.
Apparently the problem exists in parsing the arguments before they are processed by the core emulator functions.

Actions #2

Updated by JosJuice over 7 years ago

  • Status changed from New to Accepted
  • Milestone set to Current
  • Regression changed from No to Yes
  • Regression start set to 5.0-2624

Reproduced and bisected.

Actions #3

Updated by JosJuice over 7 years ago

  • Has duplicate Emulator Issues #10437: Game ISOs whose names contain special characters no longer launch from the command line—but they do launch if opened from within Dolphin added
Actions #4

Updated by Shal about 7 years ago

I've found out that until recently WxApps did not support other characters than ASCII and this commit seems to solve the problem on windows : https://trac.wxwidgets.org/ticket/14580

Actions #5

Updated by jack980517 about 7 years ago

Shal wrote:

I've found out that until recently WxApps did not support other characters than ASCII and this commit seems to solve the problem on windows : https://trac.wxwidgets.org/ticket/14580

I don't think what you said is related to this issue. After all, Dolphin can properly display non-ASCII game names, and can successfully load ROMs with non-ASCII path from the File-Open menu. The issue only exists in command line argument parsing, and is introduced by a change in the method to parse command line arguments. This is the commit that corresponds to 5.0-2624, where this regression started: https://github.com/dolphin-emu/dolphin/pull/4916

Actions #6

Updated by Shal about 7 years ago

Still think the issue is here. The issue in the link is very specific to the command line arguments in WxApps.
Though it seems like fixing it will take time.

Have a look at wxWidgets/cmdargs.h : https://github.com/wxWidgets/wxWidgets/blob/master/include/wx/cmdargs.h

lign 54 we have a :
m_argsA[n] = wxStrdup(m_args[n].ToAscii());

And this is where, when I'm debugging, that my japanesefilename get lost to "___.gcm".

I'm a coming from the Java scene and fixing this in C++ is out of my reach.

Actions #7

Updated by jack980517 about 7 years ago

Seems reasonable. But why did pre-2624 Dolphin work correctly then?

Actions #8

Updated by Shal about 7 years ago

Nice investigation. Indeed it worked pre-2624.
So I think I've found the commit introducing this bug : https://github.com/dolphin-emu/dolphin/commit/c2d5fe3ec90dc46166ca31b7a7c608733c52ce34#diff-f49aa275bd8773ec575dfa37e2f6247c

It is refactoring in Main.cpp functions for command line arguments and we seem to remove UTF8 compatibility : File::Exists(argv[1].ToUTF8().data())

Now we rely on wxWidgets/blob/master/include/wx/cmdargs.h that converts command line arguments to ASCII.

Actions #9

Updated by leoetlino about 7 years ago

  • Status changed from Accepted to Fix pending
Actions #10

Updated by JosJuice about 7 years ago

  • Status changed from Fix pending to Fixed
  • Fixed in set to 5.0-6012
Actions

Also available in: Atom PDF