Breaking out what remains of #3946 as a separate issue in order to get a more focused discussion and getting some progress.
As of Modelica 3.6, the language specification makes it clear that strings in Modelica shall use UTF-8 in the external C interface. On Windows, this is not the what the stdlib functions working with file paths expect, but the MSL is currently getting away with it by breaking the external C interface both in functions producing file paths and functions consuming file paths.
While it is clear to me that something needs to be done to make these functions comply with the language specification, I am not an expert on Windows development, so I cannot make a concrete proposal for which combinations of Windows-specific functions and character encoding conversions to use.
ModelicaInternal_removeFile is an example of consuming a file path:
|
if ( remove(file) != 0 ) { |
ModelicaInternal_readDirectory is an example of producing a file path:
If these functions would to the proper conversions between whatever encoding Windows uses and UTF-8, vendors would also need to make corresponding corrections to loadResource, but that's outside the scope of this issue.
Could someone who knows windows please provide some references or examples of how to write the code?
Breaking out what remains of #3946 as a separate issue in order to get a more focused discussion and getting some progress.
As of Modelica 3.6, the language specification makes it clear that strings in Modelica shall use UTF-8 in the external C interface. On Windows, this is not the what the stdlib functions working with file paths expect, but the MSL is currently getting away with it by breaking the external C interface both in functions producing file paths and functions consuming file paths.
While it is clear to me that something needs to be done to make these functions comply with the language specification, I am not an expert on Windows development, so I cannot make a concrete proposal for which combinations of Windows-specific functions and character encoding conversions to use.
ModelicaInternal_removeFileis an example of consuming a file path:ModelicaStandardLibrary/Modelica/Resources/C-Sources/ModelicaInternal.c
Line 497 in 2c0d22b
ModelicaInternal_readDirectoryis an example of producing a file path:ModelicaStandardLibrary/Modelica/Resources/C-Sources/ModelicaInternal.c
Line 612 in 2c0d22b
If these functions would to the proper conversions between whatever encoding Windows uses and UTF-8, vendors would also need to make corresponding corrections to
loadResource, but that's outside the scope of this issue.Could someone who knows windows please provide some references or examples of how to write the code?