Forum: Ruby string#encode with fallback not working

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
249c7fd851c5c5ac5a1abdb756472ae1?d=identicon&s=25 Arup Rakshit (my-ruby)
on 2013-11-11 22:00
Hi,

I am trying to replace '?' with 'e',but no luck

s = "V\345ctor"
s.encode!('ASCII',:invalid => :replace) # => "V?ctor"
s.encode(:fallback => {'?' => 'e'}) # => "V?ctor"

any help please?
This topic is locked and can not be replied to.