Skip to content

External functions working with file paths on Windows lack encoding conversions #4773

@henrikt-ma

Description

@henrikt-ma

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    L: C-SourcesIssue addresses Modelica/Resources/C-SourcesL: UtilitiesIssue addresses Modelica.Utilities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions