I have a string which has ascii special characters and i want to convert those to respective unicode characters. For example below is the string
A “razor” is a rule of thumb that simplifies decision.. \nWe’re in a post-content age. In the past,\nhealthier, wealthier life: • Toxic relationships • Comparisons • Inactivity • Complaints • Instant gratification • Overthinking • Crazy “what if” fears
Expect output
A "razor" is a rule of thumb that simplifies decision.. \nWe're in a post-content age. In the past,\nhealthier, wealthier life: • Toxic relationships • Comparisons • Inactivity • Complaints • Instant gratification • Overthinking • Crazy "what if" fears
The best result I could get is using unidecode gem. Which converted the above string to this
"A \"razor\" is a rule of thumb that simplifies decision..\nWe're in a post-content age. In the past,\nhealthier, wealthier life: * Toxic relationships * Comparisons * Inactivity * Complaints * Instant gratification * Overthinking * Crazy \"what if\" fears "
The problem with the approach is unidecode to_ascii method will convert the character if the string is in another language.