Skip to content

Commit ab3270a

Browse files
committed
Add invariant culture for decimal parsing.
1 parent 044ddde commit ab3270a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.OpenApi/Writers/SpecialCharacterStringExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license.
33

44
using System;
5+
using System.Globalization;
56
using System.Linq;
67

78
namespace Microsoft.OpenApi.Writers
@@ -188,7 +189,7 @@ internal static string GetYamlCompatibleString(this string input)
188189

189190
// If string can be mistaken as a number, a boolean, or a timestamp,
190191
// wrap it in quote to indicate that this is indeed a string, not a number, a boolean, or a timestamp
191-
if (decimal.TryParse(input, out var _) ||
192+
if (decimal.TryParse(input, NumberStyles.Any, CultureInfo.InvariantCulture, out var _) ||
192193
bool.TryParse(input, out var _) ||
193194
DateTime.TryParse(input, out var _))
194195
{

0 commit comments

Comments
 (0)