Thanks, that helps. Specifying charset=utf-8 does work.
It's a less than ideal solution though for my purposes for two reasons. First, it behaves differently under rl_returnz: there, $s2 displays correctly, but $s is something funky. (Both display the umlauted e with vanilla ns_return.) There are many places where I'm just pulling strings out of the database and writing them out so funkifying those is a poor option. :) And I'd prefer to avoid experimenting with recreating my database with a different encoding.
Second, I'd rather not have to go change all my text/html to "text/html; charset=utf8", and I'd also rather not write a wrapper that ignores the content-type.
So although I admit it's ugly as hell I'd rather modify my ad_space_to_nbsp proc to keep the same encoding. There may be one or two other procs that use regsub et al that I'd need to modify but not very many. Is there a way to do this? I tried
[encoding convertto iso8859-1 [ad_space_to_nbsp $s]]
but that didn't help. probably not surprisingly to you. :)