What is the difference between   and  ?
Solution 1
 
is a non-breaking space (
).
 
is just the same, but in hexadecimal (in HTML entities, the x
character shows that a hexadecimal number is coming). There is basically no difference, A0
and 160
are the same numbers in a different base.
You should decide whether you really need a non-breaking space, or a simple space would suffice.
Solution 2
It's the same. It's a numeric character reference.
A0
is the same number as 160
. The first is in base 16 (hexadecimal) and the second is in base 10 (decimal, everyday base).
Related videos on Youtube
Sambhaji
Updated on July 09, 2022Comments
-
Sambhaji almost 2 years
I have written one XSLT to transform xml to html. If input xml node contains only space then it inserts the space using following code.
<xsl:text> </xsl:text>
There is another numeric character which also does same thing as shown below.
<xsl:text> </xsl:text>
Is there any difference between these characters? Are there any examples where one of these will work and other will not?
Which one is recommended to add space?
Thanks,
Sambhaji -
Black over 5 yearsSo there is no difference between   and ?
-
kapa over 5 yearsNope, not at all
-
Mithc over 4 yearsI just a weird error in PHP due to the difference between
 
and 
. There was an space (" " not " ", encoded differently I guess) in anif
block, causing from undefined variables to syntax errors. I noticed it thanks to VSCode when I rewrote theif
statement andCtrl
+D
didn't match the other line even though it was the same content.