Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Commit de6c716

Browse files
committed
Use proper URL encoding
- URL encode white space using `+` instead of UTF-8 `%20`.
1 parent 24752b2 commit de6c716

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

forex.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ var pattern, _ = regexp.Compile("<div><div class=\"BNeawe iBp4i AP7Wnd\"><div><d
2929
func query(rest bool, base *string, quote *string, decimal *string, thousands *string) (*string, error) {
3030

3131
// URL encode white space
32-
*base = strings.ReplaceAll(strings.ReplaceAll(*base, " ", "%20"), " ", "%20")
33-
*quote = strings.ReplaceAll(strings.ReplaceAll(*quote, " ", "%20"), " ", "%20")
32+
*base = strings.ReplaceAll(strings.ReplaceAll(*base, " ", "+"), " ", "+")
33+
*quote = strings.ReplaceAll(strings.ReplaceAll(*quote, " ", "+"), " ", "+")
3434

3535
// Send GET request to query Google for pair
3636
response, err := http.Get("https://www.google.com/search?q="+*base+"/"+*quote+"&hl=en")

0 commit comments

Comments
 (0)