Answer the question
In order to leave comments, you need to log in
How to pass a carriage return character to url in Go so that a line break occurs in telegram?
Sending a get request:
url := "https://api.telegram.org/bot_id:AAHHaVdgdsfgR1UHrTfxfAZEAk/sendMessage?chat_id=12345&text=text \n новая строка"
resp, err := http.Get(url)
invalid control character in URL .
text \n new line
text \n new line
Answer the question
In order to leave comments, you need to log in
use url.QueryEscape
import "net/url"
...
text := url.QueryEscape("text \n новая строка")
requestURL := "https://api.telegram.org/bot_id:AAHHaVdgdsfgR1UHrTfxfAZEAk/sendMessage?chat_id=12345&text=" + text
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question