-
Notifications
You must be signed in to change notification settings - Fork 164
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
Song folders with non-ascii characters in their name are ignored without error on Windows #837
Comments
I can only add that the problem doesn't occur on Mac either, so it's really Windows only. |
I can confirm this. I've tested with |
I cannot reproduce it the way @DeinAlptraum describes it. The weird NB: it's possible this character doesn't trigger it on German systems, but should hopefully fail more consistent on English systems. What I find really weird is that that S and C are in the same Unicode block, but it's totally fine with the S but not the C. |
@s09bQ5 If you are on Windows, could you maybe look into this issue? |
No Windows here. |
I have exactly the same issue, with song "O-Zone - Dragostea din teï" and the last letter in name |
I just Edit: the bug disappears when re-adding the |
This is a good find! However, LazUTF8 is not available (at least not last I checked) when the msys/make method is used on Windows. And aren't special characters working properly in a ton of other places like lyrics or from the ini translations? |
Didn't test this explicitly, but judging from how I haven't heard of any problems there before, I would say yes. I guess it's just the SysUtils filesystem functions that can't deal with this properly... I tried looking up what exactly |
Ideally we can find a solution that doesn't require Laz. I gave up on the Lazarus editor about two seconds after opening it, and I couldn't get any of the Laz stuff to work through the MSYS method anyway. It's entirely possible that in my commit I'm just calling the wrong conversion. I am however okay with just copy-pasting the required parts of Laz somewhere in USDX. Unfortunately, I have no idea which parts that are. |
Build once with and once without that unit and then compare the list of undefined symbols in the object files? |
Not knowing enough about LazUTF8 and filename encoding on Windows, I tried to ask ChatGPT of what's going on and how it could be resolved (using code snippets from the changes in The issue you're encountering is related to handling non-ASCII file names and directories across platforms, particularly with the change from In the original version, To fix this issue while keeping it cross-platform and avoiding Lazarus-specific dependencies, you need to ensure that the file paths are converted and handled using Unicode-aware functions. Here’s how you can resolve this:
Here’s an updated version of your code that should address the issue:
Key Points:
|
#709 (comment) |
After an extensive "print a lot of things" session I eventually found that in Line 45 of UFilesystem.pas then on Windows a lot of things suddenly start working. still doesn't print the special characters to the console (didn't check the logfile) but it's at least loading files. Thank you @DeinAlptraum for confirming this. If nobody beats me to it, I'll figure out tomorrow if Linux also eats this (and if not we just type-guard it) and open a PR. Long-term we should probably start getting rid of some of the |
Actual behaviour
Songs with non-ascii characters in their folder name are not picked up by USDX on my Windows install.
E.g. usdb ID 28636 "Die Schlümpfe - Kleine grüne Geister" does not show up in-game for me, and also does not leave an error in the error log. Replacing the 'ü's by 'u's in just the folder name now produces the following error in the log:
Note how the paths show even the txt file's names with 'u's in stead of 'ü's - although I haven't renamed these!
In other cases it just displays question marks, i.e. after renaming "Żywiołak - Studzianki" to "Zywiolak - Studzianki" I get:
I also tried to let the directory traversal step print all the files it finds, here is part of the results:
"The Fox" and "Teenage Dirtbag" show what it looks like when it works, i.e. displaying the folder itself, but also all its contents. For the others, it just displays the folder, i.e. it doesn't find any files inside (before renaming the folders). Also notice how the Wolfgang Petry song is apprently somehow transliterated - the actual folder name is "Wir sind die Größten", not "Wir sind die Grosten".
If I rename both the folders and the files within to remove any non-ascii characters, they show up in-game and can be played without any problems.
This doesn't seem to affect everyone on Windows, other people have reported being completely fine. I can also play the exact same files (shared folder on a dual boot) without trouble on my Linux install.
Expected behaviour
The songs can be played without any folder/file renaming, and even if they can't, an error can be found in the log.
Steps to reproduce
Install USDX, then put any song with non-ascii characters in its name into the song folder. Start the game, see that the song doesn't show up.
Details
Provide some additional information:
The text was updated successfully, but these errors were encountered: