Where do you get the filename from in the first place? If you read it from a UTF-8 encoded text file (which is a quite common encoding for text files) then you need to convert that into UCS-4 when you assign it to your UCS-4 variable. Even though the Unicode code point for the character is the same, the binary representation is different in UTF-8 and UCS-4.
Note that it seems like I was wrong in my previous post. UCS-4 seems to be 4 bytes long like URF-32 and not 2 bytes. That means that if GFortran is going to use CreateFileW from the Windows API it needs to convert you UCS-4 encoded filename into UTF-16 for this to work properly. Really not sure if that’s the case.
No, I’m pretty sure Intel Fortran does not support UCS-4.
Also note that both Intel and GFortran technically supports Unicode because you can use the default character kind to store UTF-8 encoded strings. I wrote a post about this a while back: Using Unicode Characters in Fortran You’ll still run into problems with the Windows filesystem though because it doesn’t use UTF-8.