Trim leading and trailing spaces including problematic characters like non-breaking spaces.

=TRIM(CLEAN(SUBSTITUTE(B1,CHAR(160)," ")))