UTF-8 encoding vs Base-64 Encoding

后端 未结 1 946
清歌不尽
清歌不尽 2020-12-24 09:59

I want to encode a file it may be image or any pdf and send it to server. Which type of Encoding and decoding I have to follow. (Both server and client is in our company. we

相关标签:
1条回答
  • 2020-12-24 10:34

    UTF-8 is a text encoding - a way of encoding text as binary data.

    Base64 is in some ways the opposite - it's a way of encoding arbitrary binary data as ASCII text.

    If you need to encode arbitrary binary data as text, Base64 is the way to go - you mustn't try to treat arbitrary binary data as if it's UTF-8 encoded text data.

    However, you may well be able to transfer the file to the server just as binary data in the first place - it depends on what transport you're using.

    0 讨论(0)
提交回复
热议问题