Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base64 解码后含有很多空字符NUL #738

Open
lenny20 opened this issue Nov 19, 2023 · 3 comments
Open

Base64 解码后含有很多空字符NUL #738

lenny20 opened this issue Nov 19, 2023 · 3 comments

Comments

@lenny20
Copy link

lenny20 commented Nov 19, 2023

例如:RABQAEEAWgA2AC0AUwBIADIAVQBQAC0AUwA3AFoAWgBaAC0AWAA0ADcAVABVAC0ARgBVAEwAMgBYAA==
解码后每个字符之间都带有空字符NUL,无法搜索替换\s
复制粘贴变成:D P A Z 6 - S H 2 U P - S 7 Z Z Z - X 4 7 T U - F U L 2 X
2023-11-20_040016
我在网页版解码发现,字符编码为UTF-8也是这样,改为UTF-16LE就正常了。
Notepad2 v4.23.11 (AVX2)

@lenny20 lenny20 changed the title Base64 转码后含有很多空字符NUL Base64 解码后含有很多空字符NUL Nov 19, 2023
@zufuliu
Copy link
Owner

zufuliu commented Nov 20, 2023

The decoded result is correct:

>>> import base64
>>> base64.b64decode('RABQAEEAWgA2AC0AUwBIADIAVQBQAC0AUwA3AFoAWgBaAC0AWAA0ADcAVABVAC0ARgBVAEwAMgBYAA==')
b'D\x00P\x00A\x00Z\x006\x00-\x00S\x00H\x002\x00U\x00P\x00-\x00S\x007\x00Z\x00Z\x00Z\x00-\x00X\x004\x007\x00T\x00U\x00-\x00F\x00U\x00L\x002\x00X\x00'

@zufuliu
Copy link
Owner

zufuliu commented Nov 20, 2023

You can save the decoded result in a file then reload the file with UTF16-LE encoding.

@lenny20
Copy link
Author

lenny20 commented Nov 23, 2023

要重新打开挺麻烦的 -_-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants