I have a string "some_string" which has been encoded in below way and returns encoded value "some_encoded_value" :
select utl_encode.base64_encode(utl_raw.cast_to_raw('some_string')) from dual;
I want to decode it in python2.7 but I am unable to do so.
I am trying to do it in the following way :
base64.b64decode("some_encoded_value")
Output of this python returns some characters like which dont look like normal string
\xe4\x5t\xe6\x7e..... etc
Can you please let help me out in this.
All i have been able to figure out it is we might need something similar to cast_to_var2 in python but I am unable to find it.
1 Answer 1
You first snippet calls two functions...
utl_encode.base64_encode(utl_raw.cast_to_raw('some_string'))
Your second snippet calls the reverse of one of those two functions...
You need to reverse both of them...
UTL_RAW.CAST_TO_VARCHAR2(utl_encode.base_64decode("some_encoded_value"))
Manual :
- https://docs.oracle.com/database/121/WSMQG/app_urpkg.htm#WSMQG293
- https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_encode.htm#i996731
Or, to convert binary to string in python...