I have some javascript that reads the user input from an HTML field (using .text() ). I am then sending that text via URL (FMP protocol, not HTTP, but does the same encoding).
When I enter in multiple spaces (adjacent to each other) I get an apparently rather odd URL encoding result. So, here are some examples with the resulting encoding (one with one space, one with two spaces):
Bob Bob => Bob%20Bob
Bob Bob => Bob%20%c2%a0Bob
%C2 is an 'A' with a symbol over it, while %A0 appears to be a blank?
The problem lies in that on the receiving end of this it doesn't decode correctly as two spaces, but as some other strange characters. Here's some sample code:
$('.newEntry').on('blur', function() {
var text = encodeURIComponent ( $('.newEntry').text() ) ;
if ( currentComment != text ) {
window.location = 'fmp://blar.com/Sol?script=AddComment&$commentID=new&$commentText=' + text ;
}
});
Can someone help explain while double spaces are coming through this way? It is HIGHLY probable that we will get double spaces as this is a free form text entry by the user, and they are entering notes to be read by other people.
Thanks, J
%20
repeated as expected. – diolemo Jan 8 at 0:28