RareBreeds Eugene not working - solved

Yes. Thank you so much!

1 Like

Thanks for reporting this mzikutko, and for trying out Eugene!

I might need to find a Windows laptop. My code does pass file paths to json_load_file which calls fopen. Apparently fopen doesn’t like utf-8 on windows so I may need to re-encode the string first, or find a different function to load the file.

2 Likes

It’s a huge pain on windows. I think I used the stuff that’s part of flac:

FLAC_API FILE* flac_internal_fopen_utf8(const char *filename, const char *mode);

I don’t depend on Flac at the moment, but it looks like openssl_fopen has a bunch of code for handling this on Windows.

VCV Rack also overrides fopen in common.cpp so I’ll try using that first rather than leaving it up to the json library.

1 Like

Oh, that’s cool! I assume you mean #define fopen fopen_u8 in common.hpp? Is that enough to make something work if you need to combine two paths, like a path, a separator, and a filename? I don’t really know - I just bash away until it works!

Oh, that’s cool! I assume you mean #define fopen fopen_u8 in common.hpp?

Yeah, in common.cpp Rack has implemented fopen_u8 so that on Windows builds it first converts the const char * to utf16 then uses _wfopen.

Luckily I don’t have to manipulate strings in any way so being able to open a file from a C string is good enough for me.

I also used ifstream though which is another thing that takes a file path to create it and doesn’t work on Windows if it contains utf8 characters.

1 Like

I’ve create a new release that should fix it. Just submitted it to the library as v2.0.3 so should eventually be made public.

5 Likes

There might be another way to resolve this issue for Windows 10:

Got to Settings / Time & Language / Administrative Language Settings, then under Language for non-Unicode programs, click Change System Locale. On that dialog there should be a check box for “Use Unicode UTF-8 for worldwide language support” turn that on. This will require a reboot to take effect.

This setting should be on by default in Windows 11.

If anyone comes across this post and tries it out, please reply to let us know if this works. There are some old applications that might break, but for many programs that originate in Linux like Rack, it might help.

3 Likes