You may not have to do any replacement at all. The parser should replace the numeric code with the mnemonic. But if it is a problem you should be able to modify the code tags using something like this (admittedly crude) code:
Okay, I quit. The freaking filters on the Microsoft side have decided that posting code in an area supposedly devoted to a programming language is forbidden. This sucks.
If there are any "moderators" reading this, they need to get this fixed. It isn't the first time I've run into this problem since they shut down the old forums and switch to this POS system.
$HTML.all.tags('code') | ForEach-Object{$.innerHTML = $.innerHTML -Replace ' ', 'NON-BREAKING-SPACE'}
You can save the modified data by using the dame code as above, but substitute "HTML" for "code" and pipe to "ForEach-Object{$_.document.documentElement.OuterHTML} | Out-File ...."
I really do apologize for having to butcher the code like this, but this freaking system refuses to accept it if it's properly formatted