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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -