Taking the entire text from the textfield

I hve attached an observer to a textfield. User can paste any text from the webpage in it. But if he /she pastes any URL then it replaces the special chars in the URL. I tried to do <%= h( but it is not working. How can i take the URL without it’s special chars not replaced??

Thanks and regards,