The nbsp is "added" in parse_bbc, there is an strtr that replaces any double space with a space + nbsp.
It should be enough to change the order in the replacement here:
$message = strtr($message, array(' ' => ' ',
to:
$message = strtr($message, array(' ' => ' ',
emanuele crosses his fingers hoping Elk will escape the stuff in code blocks, but he feels it will not.
We should find a way to show stuff in code blocks exactly as it is...