I think the OP might actually want to replace literal or entity nbspaces with regular spaces. There certainly may be reasonable reasons to want to do that.
I think that the OP might be helped by a prefilter written in python. The following tries to skip any fenced code or code blocks in order to not replace nbsp entities inside code. It may be thrown by things like `\~~~strikeout~~` but those are unlikely in practice.
import sys
import re
inp = sys.stdin.read()
txt = inp.decode('utf-8')
pat = u"""(?isxu)
# Match delimited code or code block
(?P<code>
(?P<backtick> \`{1,} ) .*? (?P=backtick)
|
(?P<tilde> \~{3,} ) .*? (?P=tilde)
)
|
# Match any form of nbsp
( \& (?: nbsp|[#]160|[#]xa0) \; | \u00a0 )
"""
# keep code and replace ordinary space
def rep(m):
return m.group(1) if m.group(1) else u"\u0020"
print re.sub(pat, rep, txt).encode('utf-8')
````