It is the last part that gave me grief. Rails content_for used such a construct so all my content was being converted to US-ASCII and sometimes were error off.
It seems to me the "#{ ... }" string should be utf-8 and so anything inserted into it should be converted to utf-8 so "#{nil}" should be utf-8 -- not US-ASCII.
“#{bar}”.encoding != ‘UTF-8’ and “#{bar}#{foo}”.encoding != ‘UTF-8’ despite foo being UTF-8 and the encoding of the source file and hence the “ … “ string within the source file being UTF-8.
parse.y (literal_concat_gen, evstr2dstr_gen): keep literal
encoding beginning with an interpolation same as the source file
encoding. [ruby-core:70703] [Bug #11519]