use URI::Escape; $safe = uri_escape("10% is enough\n"); #### $str = uri_unescape($safe);