Not sure what could be causing it, but when writing String to file, first half of the seems to be binary
Explanation
I read an xml file remotely through ssh2 crate, all good at these stage
let mut file_pointer: File = sftp_session.open_mode(xml_file_path.as_path(), (OpenFlags::READ | OpenFlags::WRITE), 700, OpenType::File).unwrap();
perform needed action, and updated the data
now i have the
let serialized_data = quick_xml::se::to_string(¤t_firmware).unwrap();
I checked and confirmed the serialize string is correct
"<service><setup><versionNumber>44</versionNumber><modelName>STB-5500_UA</modelName><priority>NORMAL</priority><content><type>EPK_FIRMWARE</type><subversionNumber>44</subversionNumber><data>starfish-atsc-secured-m16hstb-92.89.deua4hotel.m16hstb-22-07.61.40-prodkey_nsu_V3_SECURED.epk</data><frequency>0</frequency><programNum>0</programNum><cTag>0</cTag></content><content><type>PTC_FIRMWARE</type><subversionNumber>44</subversionNumber><data>STB_3000_v2.00.016.txt</data><frequency>0</frequency><programNum>0</programNum><cTag>0</cTag></content><content><type>CH_MAP</type><subversionNumber>34</subversionNumber><data>STB3000_MVP_IPTV_Default.tlx</data><frequency>0</frequency><programNum>0</programNum><cTag>0</cTag></content></setup></service>"
but on writing the string to file gives some weird output, only half the string is save the other half is garbage. below is the line i call
let hhh = file_pointer.write_all(serialized_data.as_bytes());
file_pointer.flush().unwrap();
opening the file on text editor shows