Bugfix release: encode spaced words

Signed-off-by: Aoi K <koizumi.aoi@kyoko-project.wer.ee>

git-svn-id: file:///srv/svn/repo/suwako/trunk@6 0b558ee1-521d-8b46-a41b-40029c97c055
This commit is contained in:
koizumi.aoi
2022-12-14 01:13:52 +00:00
parent eef6ce394a
commit 2fdb84154f
5 changed files with 7 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
// $KyokoNet: stcli-go,v 1.1 2022/12/13 10:07:00 akoizumi Exp
// $KyokoNet: stcli-go,v 1.2 2022/12/13 22:13:00 akoizumi Exp
// Command line client for SimplyTranslate, a privacy friendly frontend to Google Translate
package main
@@ -9,6 +9,7 @@ import (
"io"
"log"
"net/http"
"net/url"
"os"
)
var (
@@ -40,7 +41,8 @@ func main() {
// Map a variable to the struct
var translate Translate
// Build the full URL to query
var queryURL = instance + "?engine=" + engine + "&from=" + from + "&to=" + to + "&text=" + input
var encinput = url.PathEscape(input)
var queryURL = instance + "?engine=" + engine + "&from=" + from + "&to=" + to + "&text=" + encinput
// Begin the request and process the response
req, err := http.Get(queryURL)
sanityCheck(err)