Why are the contents of a text file unprintable/unreadable?

Hello all,

I am sending a simple text file from a PC to a Raspberry Pi computer. The file lands there properly but when opened it is not the same as what I sent. It is just characters that are not even close to the same.

8p�#��#@6��`.o��5ڮz�H�#"!�E{����W�Y��e�V>�4J�#�#+s�=MK��ds�ga#��� R�Y�%0�N#Y3�O@#�S��a��$��#�7I###xl��g#�^D�G�+!�y��Л�
֚�#4���U!����Z#���"��F3���,Dz#F|Xk�0�#N�X#�3�6��+h# �y�W�����3#�"bՐ#�9#2#5�ł�8
�E#|/�#VRmЫ-�#�)[��#^
N3L�BA�L�
a�1���xؒH�#�Du�
.4g��fr�rQQC[��g�T��#�#�c:f#�]�

Also the quantity of data is not present either (could be invisible if they are unprintable characters?)

Could the coding be off? If so how to I set it when sending, and set it again when receiving?

Thanks,
Tim

Well I figured out why it is unreadable, I was sending unencrypted data and then unencrypting it anyway, giving the bad results.

However, one thing I did find out is that when I try send encrypted data, the file never makes it to the destination. Can anyone shed some light as to why that would be?

Thanks,
Tim

How are you sending it? How are you detecting, at the receiving end, that you have received all the data and can close the connection, write the file, etc.

Does the data rely on a specific text encoding?

This might be an issue with the encoding of the text sent/received.

edit: oups… that was already suggested…

You could also explain what you mean by “encrypted”. So that’s several questions for you to answer.

Could it be that the data contains nulls? If you are stuffing the data into strings instead of memoryblocks, you could have problems.