aklomp / base64

Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
BSD 2-Clause "Simplified" License
890 stars 165 forks source link

Codepage error on Windows #138

Closed sergeevabc closed 8 months ago

sergeevabc commented 9 months ago

Windows 7 x64, base64 0.5.2

$ for %# in (*) do @echo %# %~z#
birds.txt 1024
vögel.txt 3072

$ base64 birds.txt > birds.txt.b64

$ base64 vögel.txt > vögel.txt.b64
base64: vogel.txt: No such file or directory
Usage: base64 [OPTION]... [FILE]
If no FILE is given or is specified as '-', read from standard input.
Options:
  -d, --decode             Decode a base64 stream.
  -h, --help               Print this help text.
  -i, --ignore-garbage     When decoding, ignore any non-base64 data.
  -n, --no-strip-newlines  When decoding, do not strip newlines. Speeds up
                           decoding of inputs that do not contain newlines.
  -w, --wrap=COLS          Wrap encoded lines at this column. Default 76, 0 to
                           disable.

$ for %# in (*) do @echo %# %~z#
birds.txt     1024
birds.txt.b64 1404
vögel.txt     3072
vögel.txt.b64 0

$ coreutils base64 vögel.txt > vögel.txt.b64

$ for %# in (*) do @echo %# %~z#
birds.txt     1024
birds.txt.b64 1404
vögel.txt     3072
vögel.txt.b64 4150

Changing local ANSI codepage to Unicode via chcp 65001 does not help.

aklomp commented 9 months ago

bin/base64 is a demo program that shows how to integrate the base64 library into a program. It is not intended for production use and it is not intended to be cross-platform. It's a demo. Furthermore, Windows 7 is obsolete and support from Microsoft ended over four years ago.

I'm not going to update a demo program to work on an obsolete platform. If anyone wants to contribute a patch, I can review it.

sergeevabc commented 9 months ago

This bug is reproduced under Windows 10 and 11. But the fact that you are trying to avoid investigating the well-documented bug says more about your self-confidence than about Microsoft. After all, we can all miss something, but only lazybones and laymen insist on leaving the omission as it is. In fact, this is a chance to expand your knowledge in the field of cross-platform development.