You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm not sure if the issue is 100% from this extension, but when I encode multiple lines of code with this extension, and decode it like that (react / typescript):
constbase64EncodedCode="string from extension here";constdecodedCode=atob(base64EncodedCode);
I will lose all the line breaks. But if I do the exact same thing, but instead of using the extension, I use base64decode.org tool to encode, it will work fine with their base64 string, and the line breaks will be here.
It's a bit weird because, the "decode" part of the extension will display the line breaks, but the way its encoded must be different from the other app, otherwise I would get the same result from the extension, and from the other website using atob.
I also had the issue of the special characters not being properly decoded, but I solved that using an utils :
// src/utils/base64.ts/** * Decodes a Base64 encoded string to a regular string with proper UTF-8 support. * This method ensures that special characters and line breaks are handled correctly. * @param {string} base64String - The Base64 encoded string. * @returns {string} - The decoded string. */exportconstdecodeBase64=(base64String: string): string=>{returndecodeURIComponent(atob(base64String).split("").map((char)=>{return"%"+("00"+char.charCodeAt(0).toString(16)).slice(-2);}).join(""));};/** * Encodes a string to a Base64 encoded string with proper UTF-8 support. * This method handles special characters and ensures the string is properly encoded. * @param {string} normalString - The regular string. * @returns {string} - The Base64 encoded string. */exportconstencodeBase64=(normalString: string): string=>{returnbtoa(encodeURIComponent(normalString).replace(/%([0-9A-F]{2})/g,function(match,p1){returnString.fromCharCode(parseInt(p1,16));}));};
Thank you :)
Steps To Reproduce
Encode multiple lines of code
Decode the string using JavaScript atob
All line breaks are gone
Use another tool to encode
Decode the new string with JavaScript atob
Line breaks are back
Current Behaviour
Removes all line breaks on decode
Expected Behaviour
Keeps the line breaks
The text was updated successfully, but these errors were encountered:
Extension
https://www.raycast.com/DanielSinclair/base64
Description
Hello, I'm not sure if the issue is 100% from this extension, but when I encode multiple lines of code with this extension, and decode it like that (react / typescript):
I will lose all the line breaks. But if I do the exact same thing, but instead of using the extension, I use base64decode.org tool to encode, it will work fine with their base64 string, and the line breaks will be here.
It's a bit weird because, the "decode" part of the extension will display the line breaks, but the way its encoded must be different from the other app, otherwise I would get the same result from the extension, and from the other website using
atob
.I also had the issue of the special characters not being properly decoded, but I solved that using an utils :
Thank you :)
Steps To Reproduce
atob
atob
Current Behaviour
Removes all line breaks on decode
Expected Behaviour
Keeps the line breaks
The text was updated successfully, but these errors were encountered: