How to replace an unicode quotation marks with an ascii in ruby 1.8?

503 Views Asked by At

How to find and replace unicode quotation marks in ruby 1.8.7? For example, from:

“Good morning.”

to:

'Good morning.'
1

There are 1 best solutions below

3
On BEST ANSWER

You should be able to do normal search and replace, e.g:

>> '“Good morning.”'.gsub(%r/“|”/, "'")
=> "'Good morning.'"