Lets say we have the string '\342\200\231' (same as "\\342\\200\\231"). What is a quick way to convert this string to "\342\200\231" (same as ’ Unicode character)?
Proposal:
s.gsub(/\\(\d{3})/) { $1.oct.chr }
It depends on what assumptions you can make about your input.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With