ReneNyffenegger / cpp-base64

base64 encoding and decoding with c++
Other
891 stars 311 forks source link

handling special characters #5

Closed Zekke closed 4 years ago

Zekke commented 6 years ago

Hello, can you add an handling to special characters in the decode function ? For example, with your actual implementation, "w6k=" will return "é" instead of "é".

Thank you :)

Satancito commented 5 years ago

@Zekke "w6k=" decoded is equals to "é", The problem is on Windows, it uses UTF-16, you need to convert your std::string to std::wstring and print using Windows native function "https://docs.microsoft.com/en-us/windows/console/writeconsole"

Check my Answer in Stackoverflow, With detailed instructions. https://stackoverflow.com/questions/2492077/output-unicode-strings-in-windows-console-app/54833872#54833872

ReneNyffenegger commented 4 years ago

é is an é, encoded in UTF-8, but displayed as latin-1. If you process the é in an "UTF-8 context", it will be displayed as é.