modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
470 stars 168 forks source link

Support Unicode Strings in MSL #3946

Open HansOlsson opened 2 years ago

HansOlsson commented 2 years ago

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:

Notes:

beutlich commented 2 years ago

Can this be seen as follow-up for #3789?

HansOlsson commented 2 years ago

I would say this issue represents the minimum, whereas #3789 extends this to other cases.

henrikt-ma commented 2 years ago

As I see it, it means that the the MSL string handling functions are actually fine as they are as long as the targeted Modelica language version doesn't exceed 3.5, but that one break these functions by switching to a newer MLS version without making sure that the functions operate on something more sensible than bytes.

Fortunately, the string handling functions could be updated for UTF-8 already today, as they would remain valid also under the constraint that they only operate on ASCII strings. That is, they would remain compatible with the current target MLS 3.4, as well as both 3.5 and future versions. A minor concern would be that making them UTF-8 ready would encourage invalid use as long as the targeted MLS version doesn't exceed 3.5.

maltelenz commented 1 year ago

I believe this part hasn't been done yet, but I'm happy to be proven wrong:

File handling routines should accept file names encoded using UTF-8.

Reopening.

HansOlsson commented 1 year ago

I believe this part hasn't been done yet, but I'm happy to be proven wrong:

File handling routines should accept file names encoded using UTF-8.

Reopening.

As far as I understand it will likely work without changes for *nix-variants.

For Windows there are two options:

sjoelund commented 1 year ago

For the manifest, it would then only work for updated OSes, and only if the tool compiling the executable sets that flag. MultiByteToWideChar is pretty simple to use.

TManikantan commented 1 year ago

@HansOlsson what do you propose as the next work plan?

TManikantan commented 1 year ago

@HansOlsson @MartinOtter second part of the issue which is unaddressed, would you please look into it?

MartinOtter commented 1 year ago

I have not enough knowledge to have an opinion or contribute here. @HansOlsson, @sjoelund please give advice how to continue/make a pull request