You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fr-CA culture is different in Linux than Windows #54021
@jonathanmasseurca thanks for reporting the issue.
I believe .NET 5.0 behavior on Windows is same as the behavior when running on Ubuntu too. You should be getting 2008-03-15 18 h 23 h 32. You may be not getting that either because you have fa-CA set as default user culture on the machine and picking up the user setting Windows or you are enabling NLS through a config switch.
To explain more about the issue, when formatting a date/time with fr-CA culture and using the date pattern yyyy-MM-dd HH:mm:ss, the : in this pattern is not the literal colon character but it means the time separator. The time separator is derived from the culture time formatting pattern itself. For fr-CA, it has the time pattern as HH 'h' mm 'min' ss 's' and that cause the framework get h as the time separator.
If you want to force the : in the date formatting, you may use something like yyyy'-'MM'-'dd HH':'mm':'ss instead.
I just tried on Windows Server 2019 using en-US as the windows language, I have a valid time :
2008-03-15 18:23:32
2008-03-15 18:23:32
2008-03-15 18:23:32
The issue is somehow just in the linux build and only affect fr-CA culture (fr-FR is showing a valid time in linux not sure why only fr-CA has this weird issue)
The issue is when we are using ICU library. If you try Windows 10 client, you should see the same Linux behavior with .NET 5.0.
That is right, I just did a fresh install of Windows 10 client using en-US, I confirm to have now the same behavior as Linux on NET Core 5 with the h separator,
I did another test with Framework 4.7.2, it's interesting that on Framework 4.7.2 it came back with the : (Probably it's not using the ICU library or not the same one as NET Core 5).
Activity
michaelgsharp commentedon Jun 10, 2021
Were you using x86 or x64?
jonathanmassehsj commentedon Jun 10, 2021
x64 on both.
Windows 10 x64 Professional @ version 10.0.19043.1052.
Ubuntu x64 20.04.2 LTS
michaelgsharp commentedon Jun 10, 2021
Also reproes on Ubuntu x64 18.04 (WSL 2) with .NET 6 preview 3. Transferring to the runtime team who own System.Globalization.
tarekgh commentedon Jun 10, 2021
@jonathanmasseurca thanks for reporting the issue.
I believe .NET 5.0 behavior on Windows is same as the behavior when running on Ubuntu too. You should be getting
2008-03-15 18 h 23 h 32. You may be not getting that either because you havefa-CAset as default user culture on the machine and picking up the user setting Windows or you are enablingNLSthrough a config switch.To explain more about the issue, when formatting a date/time with
fr-CAculture and using the date patternyyyy-MM-dd HH:mm:ss, the:in this pattern is not the literal colon character but it means the time separator. The time separator is derived from the culture time formatting pattern itself. Forfr-CA, it has the time pattern asHH 'h' mm 'min' ss 's'and that cause the framework gethas the time separator.If you want to force the
:in the date formatting, you may use something likeyyyy'-'MM'-'dd HH':'mm':'ssinstead.jonathanmassehsj commentedon Jun 11, 2021
Thank you for your quick reply @tarekgh, I really appreciate,
My windows language is en-US.
In French h is not considered the separator, h means (h for heure, meaning hour), so it cannot be the separator, it should be the :
In French (2008-03-15 18 h 23 h 32) is not considered a valid time because h is only allowed when it's HH:mm, Ex : 23 h 23 (is valid)
https://en.wikipedia.org/wiki/Date_and_time_notation_in_France
https://en.wikipedia.org/wiki/Date_and_time_notation_in_Canada
I just tried on Windows Server 2019 using en-US as the windows language, I have a valid time :
2008-03-15 18:23:32
2008-03-15 18:23:32
2008-03-15 18:23:32
The issue is somehow just in the linux build and only affect fr-CA culture (fr-FR is showing a valid time in linux not sure why only fr-CA has this weird issue)
Many thanks @tarekgh for your help,
tarekgh commentedon Jun 11, 2021
That is right. We need to fix the logic in the framework how we can get the time separator for such cultures.
The issue is when we are using ICU library. If you try Windows 10 client, you should see the same Linux behavior with .NET 5.0.
jonathanmassehsj commentedon Jun 11, 2021
That is right, I just did a fresh install of Windows 10 client using en-US, I confirm to have now the same behavior as Linux on NET Core 5 with the h separator,
I did another test with Framework 4.7.2, it's interesting that on Framework 4.7.2 it came back with the : (Probably it's not using the ICU library or not the same one as NET Core 5).
Many thanks @tarekgh
danmoseley commentedon Jul 27, 2021
@tarekgh is there more work for us here ("we need to fix the logic in the framework") or can we now close this?
tarekgh commentedon Jul 27, 2021
@danmoseley this needs to get fixed in the framework. That is why I am keeping it in 6.0 milestone.