@barry_milliken_droid See …
require 'uri'
# Default replacement:
path = URI.encode("file:///C:/Program Files/SketchUp/Some Subfolder/@!help.html")
#=> file:///C:/Program%20Files/SketchUp/Some%20Subfolder/@!help.html
# Specify a character set to replace as 2nd argument:
path = URI.encode(
"file:///C:/Program Files/SketchUp/Some Subfolder/@!help.html",
" !@" # ie: space, exclamation point, asterisk
)
#=> file:///C:/Program%20Files/SketchUp/Some%20Subfolder/%40%21help.html
NOTE: These methods have a note that they are obsolete and that there are alternatives like CGI.escape and URI.encode_www_form_component, but they both want to change spaces to “+” which might not work well. (I’ve no Mac so Steve’ll need to weight in.)