How to insert a single backslash in ruby when string come from URI decode -


i have encoded encrypted value pass value url this

"%5cx9dj%5cxb2%3dr%5cx81%5cxda%5cx96t%5cxa1%7e%5cxe8d7%5cx81%5cx91" 

but when decoded value ruby return string this

"\\x9dj\\xb2=r\\x81\\xda\\x96t\\xa1~\\xe8d7\\x81\\x91" 

instead of this

"\x9dj\xb2=r\x81\xda\x96t\xa1~\xe8d7\x81\x91" 

how can convert double backslashes single backslash ?

i try gsub ('\\'){'\'} returned same value

here code

 encrypted_value = uri.decode("%5cx9dj%5cxb2%3dr%5cx81%5cxda%5cx96t%5cxa1%7e%5cxe8d7%5cx81%5cx91") @decrypted_id=encryptor.decrypt(encrypted_value, :key => secret_key, :iv => iv, :salt => salt) 

thanks in advance

it's confusing display issue. don't have change , value should work decryption. however, when print value, it'll show \\ first \ reserved escape character.


Comments