Yup, this is definitely OK according to the v2 migration docs:
loadFont() and loadImage() caches the font/image by its path, so this operation can be efficiently called in draw() every frame.
^ This looks a bit like I’m throwing the whole doc at you, but it’s actually a direct link to the section I quoted, just to prove I’m not talking out of my ass.
APIs like rack::asset::plugin have type std::string. The documentation says on windows some items which require a UTF16 string require you to call rack::string::UTF8ToUTF16 which returns a std::wstring and the rack code has, in a few places, a call to that and then a call to .c_str() (notably not.wc_str()) before a load. For instance here’s some code on how to set up an archive from src/system.cpp
// Open file
#if defined ARCH_WIN
r = archive_write_open_filename_w(a, string::UTF8toUTF16(archivePath).c_str());
#else
r = archive_write_open_filename(a, archivePath.c_str());
#endif
butSvg::load has signature const std::string & and all through the rack code the calls to Svg::load use the output of rack::asset::system directly. So I am presuming that somehow nvgSvgParse has been patched like fopen has
Is there a definitive set of APIs which require you to call UTF8toUFT16? My understanding was it was
Any filesystem API which takes a char * requires the conversion on windows, as above
Any rack API which takes a std::string does not (and cannot since UTF16 returns a std::wstring)
That makes me think that, in the Surge XT case, our call to json_load_file probably needs an ifdef and protection but our call to loadSvg does not. Explicitly this code:
should work on all OSes even ifs someone on windows has their directory as "c:\Magical " but the json_load_file needs protection
Not that I have a bug report other than a mention here in this thread though! And I won’t have a windows box available until at least the end of the weekend.
so it clearly expects a UTF8 path inbound (and uses ghc filesystem, which is a sub in for std::filesystem that we also have used in surge). So as long as you aren’t doing any math on your string you should be fine since it’s all UTF-8 up to that api point as far as I can see. Maybe?
again like I said I don’t have a bootable windows box to test on right now.
Assuming this name is spelled correctly (which seems likely), and assuming you or the user didn’t mangle the log output in a text editor, and assuming that the users´ home directory is actually C:\Users\Aurélien\ on disk, then comparing with the original log output you presented in the top post:
And even though it would work, if not for bugs, I always say that no programmer would create a user name with non ascii characters. It’s just asking to be bitten by bugs.
It was a lot of work to get SFZPlayer to work on all platforms with Unicode file paths.
True, and I adhere to the same from bitter experience. But for normal users they often don’t have a choice, and/or don’t know the ramifications when they innocently type in their actual name in their language. It should be reasonable to assume that “things just work”, except they don’t of course, and that’s just another reason that people (rightly) distrust IT. Heck, in my bitter old days as a programmer now, I have come to largely shy away from “smart things”, and generally prefer low tech whenever possible. Sigh…
Not related to anything I’ve done with rack, but I did once have VSCode decompose some unicode into precursor characters so that some literal unicode strings HAD to be expressed as unicode code numbers.
Quick update – A reinstall of Windows 10 solved the user’s issues, but I didn’t glean much new information from his message. I also haven’t run tests (as suggested by Squinky and Baconpaul) myself yet and hope to do that soon.
After a complete reinstallation of Windows 10, VCV works like a charm, and your plugins too
I strongly suspect the default “Document” folder, because I met similar problems with a VST, which couldn’t display the built-in presets stored in that “Document” folder.
Well good thing is I found one spot in surge where we might have an issue which I’ve fixed. It’s just that user skin preferences may not be saved with unicode user names, nothing fatal but definitely that review of my code made me fix one spot.
The was a time a while back where a user was getting some very odd behaviour with the display of MindMeld modules.
He reported it to us on a Sunday morning and Marc and I spent a good part of our Sunday (around 4 or 5 hours) investigating…
It eventually transpired that he had a Cyrillic username or some such and right at the end he told us none of his other Rack plugins were displaying properly either… so it was never a MindMeld issue in the first place. And he had already reported the issue to VCV the day before in regards to Fundamental modules… it was a bug in Rack.
This will surprise no-one, I’m sure. Back in the late 80’s I used to talk to customers on the phone. Some were super nice, like Peter Asher and Kraftwerk. Many were not.
Once I told a customer I would refund his full purchase price of our software ($500 way back then!) if he promised to never use it again or call again.
Eventually the company developed a policy that if you put a customer on the phone with me and something bad happened, it was not my fault, it was the fault of whoever forwarded the call to me.
Could be. However filenames on Windows would rarely be UTF-8 but rather some “Latin” variant in this case, so my guess would be the other way around - Latin printed as UTF-8 by Rack, which I think tries to be UTF-8 throughout.