Telegram-iOS icon indicating copy to clipboard operation
Telegram-iOS copied to clipboard

Spaces are changed to `+` when sending a message from an iPhone

Open andrey-pavlenko opened this issue 9 months ago • 1 comments

Strange behavior:

Link tg://msg_url?url=https%3A%2F%2Fqui-quo.ru&text=System+for+creating+tour+selections%0AThe+main+thing+in+the+work+of+a+travel+agency+is+working+with+the+client%2C+not+with+the+computer.+1/

Sends this message from iPhone

Image

and this message from Android

Image

The link is created using code

"tg://msg_url?" +
  new URLSearchParams({
    url: "https://qui-quo.ru",
    text: "System for creating tour selections\nThe main thing in the work of a travel agency is working with the client, not with the computer",
  }).toString();

Link tg://msg_url?url=System+for+creating+tour+selections%0AThe+main+thing+in+the+work+of+a+travel+agency+is+working+with+the+client%2C+not+with+the+computer.+2%0A%0Ahttps%3A%2F%2Fqui-quo.ru/

Sends this message from iPhone

Image

and this message from Android

Image

The link is created using code

"tg://msg_url?" +
  new URLSearchParams({
    url: "System for creating tour selections\nThe main thing in the work of a travel agency is working with the client, not with the computer\n\nhttps://qui-quo.ru",
  }).toString();

How to preserve spaces when sending a message from an iPhone?

andrey-pavlenko avatar Apr 03 '25 07:04 andrey-pavlenko

Also facing the same issue — did you find any workaround?

From what I’ve observed, Telegram seems to parse %0A as a newline only when there are no spaces in the message.

If the text includes URL-encoded spaces (%20), Telegram correctly renders those as spaces, but fails to interpret %0A as a line break.

On the other hand, when there are no spaces (or when spaces are replaced by + instead of %20), Telegram correctly parses %0A as a newline. It seems like the presence of %20 breaks newline parsing entirely.

Looks like an inconsistent URL decoding issue on Telegram’s side.

PriyanshuMallick avatar Jul 04 '25 16:07 PriyanshuMallick