ruby incorrect encoding of pound sign(£)

Problem
You want to pass the £ sign to an http service, but the ruby CGI.escape encodes it incorrectly.

Solution
After using ruby’s CGI.escape for the string as:

sms_msg_tmp=CGI.escape(sms_code)

then replace the encoding with the pound sign encoding as in:

sms_msg=sms_msg_tmp.gsub('%C2%A3','%A3')

It should then pass the correct value for the £ sign.