Skip to content

Commit 4705928

Browse files
committed
Use region invariant number for UrlEncoded
1 parent f4988ad commit 4705928

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/WebHelpers.bas

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,14 +1736,18 @@ End Function
17361736

17371737
' Helper for url-encoded to create key=value pair
17381738
Private Function web_GetUrlEncodedKeyValue(Key As Variant, Value As Variant) As String
1739-
' Convert boolean to lowercase
1740-
If VBA.VarType(Value) = VBA.vbBoolean Then
1739+
Select Case VBA.VarType(Value)
1740+
Case VBA.vbBoolean
1741+
' Convert boolean to lowercase
17411742
If Value Then
17421743
Value = "true"
17431744
Else
17441745
Value = "false"
17451746
End If
1746-
End If
1747+
Case VBA.vbDecimal, VBA.vbSingle, VBA.vbDouble, VBA.vbCurrency
1748+
' Use region invariant number encoding ("." for decimal separator)
1749+
Value = VBA.Replace(VBA.CStr(Value), ",", ".")
1750+
End Select
17471751

17481752
' Url encode key and value (using + for spaces)
17491753
web_GetUrlEncodedKeyValue = UrlEncode(Key, SpaceAsPlus:=True) & "=" & UrlEncode(Value, SpaceAsPlus:=True)

0 commit comments

Comments
 (0)