Unable to decode double encoded special characters in rails -
i'm getting data api special characters are getting double encoded. mean ’ encoded ’. know how decode unable double decode. i've tried raw , html_safe neither decode past ’, if double i.e. raw raw or .html_safe.html_safe. how can decode these characters?
this works...
require 'rubygems' require 'nokogiri' my_string = "this sam’s bicycle" decoded_string = nokogiri::html(my_string.gsub('&','&')).text puts decoded_string => => "this sam's bicycle"
Comments
Post a Comment