I
I
Igor Braduloff2019-08-30 09:23:32
Character encoding
Igor Braduloff, 2019-08-30 09:23:32

Why is base64 encoding different on windows and Linux?

I encode the string via openssl on the Win10 command line and the same string in the CentOs console. The result is different on these OSes. utf-8 encodings. Why is that?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
vreitech, 2019-08-30
@pandinus

direct the output in both cases to files and compare these files (look in a hexadecimal viewer), that's the point.
either the encoding is different, or someone (Windows, I suppose) puts BOM at the beginning of the line, or there is a line break (it is different in different OSes).

D
Developer, 2019-08-30
@samodum

The base64 algorithm is single and unambiguous.
If the strings are different, then the input is different strings. It's most likely a coding issue. Check input strings

S
SunTechnik, 2019-08-30
@SunTechnik

Here you can decode the string back online and understand which OS the error is on:
https://www.base64decode.org/
Win10 uses 866 encoding by default on the command line.
To configure - read about the chcp command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question