hi all,
i have one problem while encoding the special characters like
‘’,./?:""!@#$%^&*():;{}[] >,I get string of book name containing some
special characters,
now i have to replace those characters with encoded value so i write
following function below:-
def special_char(text)
#puts “bookname in special_char::::== #{text}”
searchwords = text
arrlength= searchwords.length
#puts “arrlength::::== #{arrlength}”
arrlength.times do|i|
str=searchwords[i]
str=str.gsub(’%’,’%25’),
str=str.gsub(’|’,’%7C’),
str=str.gsub('\'','%5C'),
str=str.gsub(' ','%20'),
str=str.gsub(',','%2C'),
str=str.gsub('?','%3F')
searchwords[i]=str
end
but when i pass the parameter text it gives me error :“private method
`gsub’ called for 84:Fixnum”
if i add one more line in above function as suppose for ( this special
character it will give the above error.
thanks in advanced
–
Regards
Sachin S. Kewale