I’m reading the output of a command line application via the shell class, but having a problem when that output contains extended characters.
The specific example that triggered this issue is the filename:
Fun., Janelle Monáe - We Are Young (feat. Janelle Monáe).mp3
If I run the command in the command prompt, the filename looks just as it does above. But reading the data from .ReadAll yields the following:
Fun., Janelle Monße - We Are Young (feat. Janelle Monße).mp3
I have tried using .ConvertEncoding(Encodings.UTF8) without success. What’s interesting is that the Unicode á character code is 225, which is the same as the ASCII code for ß. So it seems this may be some Unicode/ASCII mix-up.
Any ideas on how to properly import the string so that I can get the correct character?
Edit: I should mention on MacOS it works fine. It’s only on Windows that I have this character issue.
Alternatively, you could maybe execute something in the shell that outputs a known set of characters. Your Xojo code could then run through the different encodings until the characters match.
This works, but I think you should consider also using DefineEncoding on the Mac string as well (unless it already has a non-Nil encoding). I believe it should be set to UTF-8.
Also - I’m a little surprised that I can’t find a way in Xojo to get the operating system’s default text encoding. You could then avoid all the platform-specific code and just do: