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

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*

2
go.mod
View File

@@ -1,5 +1,3 @@
module git.kyoko-project.wer.ee/koizumi.aoi/stcli-go module git.kyoko-project.wer.ee/koizumi.aoi/stcli-go
go 1.18 go 1.18
require github.com/astaxie/bat v0.0.2

2
go.sum
View File

@@ -1,2 +0,0 @@
github.com/astaxie/bat v0.0.2 h1:EOl52CfuFEnFqu9/mzex93mh7JWdtEGbGQlpih00GWQ=
github.com/astaxie/bat v0.0.2/go.mod h1:poAI7wDJd5LpfwfBXsGWYIqmVO66dhBx31zhn0ZXdMI=

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 // Command line client for SimplyTranslate, a privacy friendly frontend to Google Translate
package main package main
@@ -9,6 +9,7 @@ import (
"io" "io"
"log" "log"
"net/http" "net/http"
"net/url"
"os" "os"
) )
var ( var (
@@ -40,7 +41,8 @@ func main() {
// Map a variable to the struct // Map a variable to the struct
var translate Translate var translate Translate
// Build the full URL to query // 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 // Begin the request and process the response
req, err := http.Get(queryURL) req, err := http.Get(queryURL)
sanityCheck(err) sanityCheck(err)

View File

@@ -1,4 +1,4 @@
.Dd Aftermath 56, 3188 .Dd Aftermath 57, 3188
.Dt STCLI-GO 1 .Dt STCLI-GO 1
.Os .Os
.Sh NAME .Sh NAME
@@ -38,5 +38,4 @@ Target language to translate to
.Pp .Pp
.An Baobab Aq Mt baobab@honeypot.im .An Baobab Aq Mt baobab@honeypot.im
.Sh BUGS .Sh BUGS
This utility cannot translate strings None so far
separated by spaces.