Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "+" and "%A0" - urlencoding?

I am url encoding a string of text to pass along to a function. However, it encodes the second space in a double-space as "%A0". This means that when I decode the string, the "%A0" is displayed as a question mark in a black box.

I really just need to be able to remove the extra space, but I'd like to understand what is causing this and how to handle it correctly.

For example:

Something  Something else

Encodes to:

Something+%A0Something+else
like image 781
rybo Avatar asked May 31 '11 19:05

rybo


1 Answers

%A0 indicates a NBSP (U+00A0). + indicates a normal space (U+0020). The NBSP displays as a replacement character (U+FFFD) because the encoding of the character does not match the encoding of the page, so its byte sequence is not valid for the page.

like image 50
Ignacio Vazquez-Abrams Avatar answered Oct 04 '22 01:10

Ignacio Vazquez-Abrams