Anytime Help Center

Using Padding with CE-COM2 BASE64 Encoding

Rating

​Question:

Does the BASE64 data sent to a CE-COM2 need padding?

Answer:

Yes, you must utilize padding when sending BASE64 encoded byte data to a CE-COM2.

In JSON packets, byte data that is transferred between the CE-COM2 and the serial device is converted using BASE64 encoding and then added to the packet.  BASE64 encoded data must always be sent in multiples of 4 characters.

For example, the word "Hello" in ASCII is encoded as "SGVsbG8=".  Since "SGVsbG8" is only 7 characters, and you must send multiples of 4 characters, we "pad" the data with an "=" sign at the end of the string to make 8 characters. 

Depending upon the length of the encoded string, you will see between 0-3 "=" signs at the end of the string.

Downloads

Product

 

Topic

Programming

Related Articles

Last modified at 1/30/2024 4:28 PM by PRO Knowledge Base
Top