Just recently, I faced same issue on textbox.
I took data from SharePoint list multiline of text.
The reason is because of non break space in original text.
You can use the following function to replace all non break space with normal space
substitute(/original_text/," "," ")
Replace your text value in /original_text/
The first space in function is non break space where I copied from original text.
The second space is normal space.
This approach help me to resolve the issue.