Skip to content
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

Fix the ICU time format conversion logic #103681

Merged
merged 13 commits into from
Jun 21, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,15 @@ private static string ConvertIcuTimeFormatString(ReadOnlySpan<char> icuFormatStr
}
break;

case ':':
case '.':
case 'H':
case 'h':
case 'm':
case 's':
case ' ':
case '\u00A0': // no-break space
case '\u202F': // narrow no-break space
result[resultPos++] = current;
break;
case 'a': // AM/PM
case 'b': // am, pm, noon, midnight
case 'B': // flexible day periods
tarekgh marked this conversation as resolved.
Show resolved Hide resolved
if (!amPmAdded)
{
amPmAdded = true;
Expand All @@ -398,6 +395,13 @@ private static string ConvertIcuTimeFormatString(ReadOnlySpan<char> icuFormatStr
}
break;

default:
// Treat non-ASCII characters as literals
tarekgh marked this conversation as resolved.
Show resolved Hide resolved
if (!char.IsAsciiLetter(current))
{
result[resultPos++] = current;
}
break;
}
}

Expand Down
Loading