Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 86fe354

Browse files
committed
Add CultureInfo.InvariantCulture when parsing primitives
1 parent 77bfed8 commit 86fe354

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/ServiceStack.Text/Common/DeserializeBuiltin.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ private static ParseStringDelegate GetParseFn()
4545
case TypeCode.Int16:
4646
return value => short.Parse(value, CultureInfo.InvariantCulture);
4747
case TypeCode.UInt16:
48-
return value => ushort.Parse(value);
48+
return value => ushort.Parse(value, CultureInfo.InvariantCulture);
4949
case TypeCode.Int32:
5050
return value => int.Parse(value, CultureInfo.InvariantCulture);
5151
case TypeCode.UInt32:
52-
return value => uint.Parse(value);
52+
return value => uint.Parse(value, CultureInfo.InvariantCulture);
5353
case TypeCode.Int64:
5454
return value => long.Parse(value, CultureInfo.InvariantCulture);
5555
case TypeCode.UInt64:
56-
return value => ulong.Parse(value);
56+
return value => ulong.Parse(value, CultureInfo.InvariantCulture);
5757
case TypeCode.Single:
5858
return value => float.Parse(value, CultureInfo.InvariantCulture);
5959
case TypeCode.Double:
@@ -86,21 +86,21 @@ private static ParseStringDelegate GetParseFn()
8686
case TypeCode.Boolean:
8787
return value => string.IsNullOrEmpty(value) ? (bool?)null : value.Length == 1 ? value == "1" : bool.Parse(value);
8888
case TypeCode.Byte:
89-
return value => string.IsNullOrEmpty(value) ? (byte?)null : byte.Parse(value);
89+
return value => string.IsNullOrEmpty(value) ? (byte?)null : byte.Parse(value, CultureInfo.InvariantCulture);
9090
case TypeCode.SByte:
91-
return value => string.IsNullOrEmpty(value) ? (sbyte?)null : sbyte.Parse(value);
91+
return value => string.IsNullOrEmpty(value) ? (sbyte?)null : sbyte.Parse(value, CultureInfo.InvariantCulture);
9292
case TypeCode.Int16:
93-
return value => string.IsNullOrEmpty(value) ? (short?)null : short.Parse(value);
93+
return value => string.IsNullOrEmpty(value) ? (short?)null : short.Parse(value, CultureInfo.InvariantCulture);
9494
case TypeCode.UInt16:
95-
return value => string.IsNullOrEmpty(value) ? (ushort?)null : ushort.Parse(value);
95+
return value => string.IsNullOrEmpty(value) ? (ushort?)null : ushort.Parse(value, CultureInfo.InvariantCulture);
9696
case TypeCode.Int32:
97-
return value => string.IsNullOrEmpty(value) ? (int?)null : int.Parse(value);
97+
return value => string.IsNullOrEmpty(value) ? (int?)null : int.Parse(value, CultureInfo.InvariantCulture);
9898
case TypeCode.UInt32:
99-
return value => string.IsNullOrEmpty(value) ? (uint?)null : uint.Parse(value);
99+
return value => string.IsNullOrEmpty(value) ? (uint?)null : uint.Parse(value, CultureInfo.InvariantCulture);
100100
case TypeCode.Int64:
101-
return value => string.IsNullOrEmpty(value) ? (long?)null : long.Parse(value);
101+
return value => string.IsNullOrEmpty(value) ? (long?)null : long.Parse(value, CultureInfo.InvariantCulture);
102102
case TypeCode.UInt64:
103-
return value => string.IsNullOrEmpty(value) ? (ulong?)null : ulong.Parse(value);
103+
return value => string.IsNullOrEmpty(value) ? (ulong?)null : ulong.Parse(value, CultureInfo.InvariantCulture);
104104
case TypeCode.Single:
105105
return value => string.IsNullOrEmpty(value) ? (float?)null : float.Parse(value, CultureInfo.InvariantCulture);
106106
case TypeCode.Double:

0 commit comments

Comments
 (0)