Base64 Encoding safe for filenames?

后端 未结 6 1733
一生所求
一生所求 2020-12-28 14:01

Is Base64 encoding safe to use for filenames on Windows and Linux systems? From my research I have found that replacing all / characters of the result with

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 14:47

    RFC 3548 suggests not only to replace the / character. The URL and Filename safe Alphabet replaces:

    • the 63:nd / character with the underscore _
    • the 62:nd + character with the minus -.

    But maybe you better use a HEX-String. It is been a while, when i stored a hash value in a filename. I started with using Base64 String but switched to a Hex-String. I don't remember why i switched, maybe because Windows makes no difference between 'a' and 'A' as AndiDog said.

提交回复
热议问题