-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get \u202F(8239) instead of ' '(32) on DateTime.ToLongTimeString when the currentCulture is en-us with in mcr.microsoft.com/dotnet/aspnet:8.0 #95620
Comments
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsDescriptionGet \u202F(8239) instead of ' '(32) on DateTime.ToLongTimeString when the currentCulture is en-us with in mcr.microsoft.com/dotnet/aspnet:8.0 Reproduction Steps
Expected behaviortime_toLongTimeString equal to "h:mm:ss tt" Actual behaviortime_toLongTimeString equal to "h:mm:ss\u202Ftt" Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Similar issue: nodejs/help#4068 |
From the linked issue (thanks!) ICU intentionally changed this to a non breaking space, which sort of makes sense as one would expect no line break there. |
Hi @danmoseley How can we roll back this change in NET8? This update will block the upgrade from NET6 to NET8. |
ICU is part of the OS distro, we do not distribute it. The linked issue suggests it's from this update https://github.com/unicode-org/icu/releases/tag/release-72-1 Could you share how this is breaking your upgrade? |
The client relies on ' '(32) for parsing data, just like fromJson('{"value":"3:53:56\u202FAM"}').value.split(' '/is 32 instead of 8239/). |
This is wrong to assume the globalization data will never change. It is consistently changing. The client needs to fix their code. Sooner or later, the client will run into more issues if they don't fix that. If want to revert using the old ICU version, you can use the app-local-icu feature. Include the following in your project. <ItemGroup>
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" />
</ItemGroup> I hope to get the client to fix their code as it is wrong approach. Note, on Windows, users can fully customize the date format to something unexpected too. |
This isn't entirely a client problem (although they should fix it too).
@czd890 - If you're passing data between systems, you should be explicitly passing the invariant culture when formatting data, especially date/time. |
@tarekgh @Clockwork-Muse Thanks! Meanwhile, we should explicitly mention this breaking change in the compatibility/8.0#globalization or compatibility/8.0#containers section, highlighting that they behave differently on Windows and Linux. What are your thoughts on this? 😂😢 |
Ah, no, you misunderstand. Except in rare cases, changes in the formatting data is not considered a breaking change on our end. This does not meet that bar.
Unless you're manually creating your own culture, no you're not - you're one OS update from it being yanked out from under you. I'd evaluate whether the |
Or I'd say more correct would be explicitly using a standardized format like RFC 3339 or ISO 8601 when serialising the dates and keeping it fixed in code. |
@Clockwork-Muse I am planning to do it this way "create and use an explicitly created/set up culture of your own". |
@MichalPetryka - Well yes, explicitly ISO would be better on top of that. |
Description
Get \u202F(8239) instead of ' '(32) on DateTime.ToLongTimeString when the currentCulture is en-us with in mcr.microsoft.com/dotnet/aspnet:8.0
on windows 11, it will get ' '(32) when running on NET8.
Reproduction Steps
Expected behavior
time_toLongTimeString equal to "h:mm:ss tt"
Actual behavior
time_toLongTimeString equal to "h:mm:ss\u202Ftt"
Regression?
Will get ' '(32) in NET6
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: