Question
Encoding in Universe Python
Hi all
I'm trying to use the PyCallFunction to run some Python code but I'm having trouble decoding Universe strings in the Python side.
This is a snippet of the Python code:
COD_DEF_SYS = 'cp1252'
SEP_MUL_DEF = chr(253)
SEP_FLD_DEF = chr(254)
def python_compression(operation: str, files: str, extra_params: str) -> str:
if operation == 'c':
file_as_bytes = bytes(file, COD_DEF_SYS, errors='backslashreplace')
bytes_separador = bytes(SEP_FLD_DEF, COD_DEF_SYS)
bytes_multivalorado = bytes(SEP_MUL_DEF, COD_DEF_SYS)
xresultado = file_as_bytes.split(bytes_separador)
print(file_as_bytes)
print(bytes_separador)
print(bytes_multivalorado)
print(xresultado)
And this is the BASIC call:
LISTA_F=''
LISTA_F<1>='hola'
LISTA_F<2>='que'
LISTA_F<3>='tal'
LISTA_F<4,1>='multi'
LISTA_F<4,2>='valorado'
RESPUESTA=PyCallFunction(NOMBRE.MODULO.PY, NOMBRE.FUNCION.PY,'c', LISTA_F, 'test')
This prints the following:
b'hola\\uf8feque\\uf8fetal\\uf8femulti\\uf8fdvalorado'
b'xfe'
b'xfd'
[b'hola\\uf8feque\\uf8fetal\\uf8femulti\\uf8fdvalorado']
b'hola\\uf8feque\\uf8fetal\\uf8femulti\\uf8fdvalorado'
If I print the string I'm getting from the PyCallFunction I get this:
hola´ú¥que´ú¥tal´ú¥multi´ú¢valorado
What encoding is this?