Skip to content

Commit 0329bcb

Browse files
committed
Merge pull request #128 from VBA-tools/regional-settings
Use region invariant number for UrlEncoded
2 parents f4988ad + f69f9ef commit 0329bcb

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

specs/regions/region-de-DE.reg

1.85 KB
Binary file not shown.

specs/regions/region-en-US.reg

1.87 KB
Binary file not shown.

specs/regions/region-nl-NL.reg

1.85 KB
Binary file not shown.

specs/regions/region-ru-RU.reg

1.84 KB
Binary file not shown.

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)