my question originated when trying to compare 2 words of different origin, one from phpmyadmin and another from excel, which visually looked exact but when executed it gave false
the difference can be seen in sublime
but then in what case is 160 used and in what others is 32
The difference between a "normal" space character (U+0020) and a "non-breaking" space character (U+00A0) is that when rendered for display in HTML for example, or in some text editors there is a difference As for the word wrap when a line break can occur, for example, if you want the string
20 gradosto remain on a single line, that is, the wrap of the text does not cause it to be displayed as
20
grados
in case the text exceeds the width of the screen after the 20y that leads gradosto the next line.
With the use of the "non-breaking space" character (U+00A0) to separate the words, it will be achieved that when the screen width is exceeded, the chain will jump
20 grados
complete to the next line and do not break across 2 lines of text.
This is the basic difference between ASCII 160 and 32, as you mention in the title of your question.
In the comparison you are doing the result is false because the space characters are different after the "9". For the comparison to result in true, as @Kilbunny's comment says, you can replace the "non-breaking" space with whitespace before comparing the strings.
The difference between a "normal" space character (U+0020) and a "non-breaking" space character (U+00A0) is that when rendered for display in HTML for example, or in some text editors there is a difference As for the word wrap when a line break can occur, for example, if you want the string
20 grados
to remain on a single line, that is, the wrap of the text does not cause it to be displayed as20
grados
in case the text exceeds the width of the screen after the
20
y that leadsgrados
to the next line.With the use of the "non-breaking space" character (U+00A0) to separate the words, it will be achieved that when the screen width is exceeded, the chain will jump
20 grados
complete to the next line and do not break across 2 lines of text.
This is the basic difference between ASCII 160 and 32, as you mention in the title of your question.
In the comparison you are doing the result is false because the space characters are different after the "9". For the comparison to result in
true
, as @Kilbunny's comment says, you can replace the "non-breaking" space with whitespace before comparing the strings.