* string.c (str_scrub): add ruby method String#scrub which verify and
  fix invalid byte sequence.

* string.c (str_compat_and_valid): check given string is compatible
  and valid with given encoding.

* transcode.c (str_transcode0): If invalid: :replace is specified for
  String#encode, replace invalid byte sequence even if the destination
  encoding equals to the source encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e