Forum: Ruby string#encode with fallback not working

249c7fd851c5c5ac5a1abdb756472ae1?d=identicon&s=25 Arup Rakshit (my-ruby)
on 2013-11-11 22:00

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?
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.