Skip to content

Support Unicode Strings in MSL #3946

Description

@HansOlsson

Based on allowing Unicode strings in Modelica Language MO#3079

We should ideally also support that in MSL, as far as I can see there are two major issues:

  • String handling should document that sub-string handling etc only work reliably when breaking at ASCII characters (and possibly at first UTF-8 character). To me that is primarily a documentation issue.
  • File handling routines should accept file names encoded using UTF-8. (This can occur before allowing Unicode strings in models since loadResource could reference a package stored in a Unicode-named directory.)

Notes:

  • The code in ModelicaStrings.c uses proper casts to (unsigned char) for isalpha etc, so it should work.
  • Thus using Modelica.Utilities.Strings.scanToken("\"€2ÅÄÖ\""); does actually work already.
  • If the intended use is to produce good text-tables of results and substrings are used for alignment/truncating it will fail miserably for Unicode and one would need significantly more advanced string-handling. Merely counting Unicode-characters isn't enough due to combining characters. A good work-around is to generate HTML-tables instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions