I have a program in Python that receives a binary file via parameter and writes this file. However, when it writes the file, some characters it replaces with a series of numbers. Below the original file I get as a parameter:
ÐT_Ö / ¤Ð樮kMμûÀz "Ô (Î", + œd¼Es ¥
But when the program writes, look at the result:
ÐT_Ö / ¤Ð樮kMμûÀz & # 148; Ô (Î, & # 147; & # 156; d¼Es ¥
You can see that the character between the z and Ô characters was replaced by the & # 148 and the + character between Î
Below the Python program code that do the binary file and write
import subprocess
from subprocess import Popen, PIPE, STDOUT
def chamaProg(arquivo):
var_file = open("C:\Nitgen\arquivo.rec","wb")
conteudo_texto = var_file.write(arquivo)
var_file.close(
Why is this happening?
What should I do to read and write all characters correctly?
Please, I need to solve this problem urgently.
Thank you.