Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unicode file names and file content

David_DiLaura1
494 Views

The latest stored topics on this forum regarding handling Unicode file names is >5 old. Has anything regarding handing Unicode file names/content changed? That is, at last check, Intel Fortran will not successfully open a file if the file name character string has Unicode characters. Is there a place (probably not in the Fortran documentation) to read comprehensively about this? The old posts write about having to convert the Unicode name to MultiByle. I need to read/learn about:

1 Detecting whether a file name character string being provided contains Unicode characters. Is that the same as detecting whether it contains multibyte characters?

2. Does the conversion (using one of the MB-functions) from Unicode to MultiByte provide a (mutibyte) character string that the Fortran OPEN routine will successfully process?

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
494 Views

OPEN will not accept multibyte strings for filenames - at least at this time. I don't know if Intel has plans to support multibyte characters in the future, but I think they will have to eventually.

As far as I know, the only way to open a file with a Unicode/Multibyte file name or path is to do the call to CreateFileW yourself in a USEROPEN routine, not for the faint-of-heart.

0 Kudos
jimdempseyatthecove
Honored Contributor III
494 Views

RE: 1

File name has nothing to do with file content.

As for determining if the content of a file is Unicode, start here: https://stackoverflow.com/questions/4672659/whats-the-best-way-to-identify-unicode-encoded-text-files-in-windows

RE: 2

This is more of an O/S issue.

Some file systems have two names for files. For example FAT32 has a Long File Name and a Short File Name. NTFS supports both long and short file names (long name is the Unicode name). On Linux, there may be something similar, perhaps symbolic link can be used.

Jim Dempsey

0 Kudos
Reply