Closed sermobile closed 7 years ago
That's a good point. I am converting it to std::wstring internally. I would still probably continue to accept std::string for the password since that's easiest for users, but I may add overloads that accept std::wstring. Thanks for the contribution.
std::vector
I just tried cyrilic password. And it's does not work.
I see what you mean. Let me think about this.
Please stick with a UTF-8 interface, and convert to UTF-16 at the very last moment (ie when you have to interact with MS libraries). I would suggest this library: https://github.com/nemtrif/utfcpp
UTF-8 all the way, baby!
Haha, thanks for the input @paulharris. That does seem like the correct approach.
utfcpp, it was used before? no? in same way, it will great to add on console windows the conversion for an appli exe to pass some args as a file name ( change font UTF-8 by chcp 65001 ) the reading (std::cin) , the output (std::cout) seem ok but i can't save the name of the file on xlnt cell, i received an error on xml::serialzation UTF8
@sukoi26 You're right--utfcpp was a dependency of xlnt in the past, but it wasn't being used so I got rid of it. I'm using codecvt from the standard library to convert UTF-8 filenames to UTF-16 on Windows, so I will probably try that for converting passwords too so I don't have to add a new dependency. Could you open a separate issue for the UTF-8 XML serialization problem with an example?
Ok , i will do
@sermobile I've improved the internal handling of passwords. The API isn't changed, but if you pass a UTF-8 encoded std::string as a password, it should work to decrypt a workbook now. Please give it a try and leave an update here if it works or doesn't work.
By the way, if you're passing the password as a string literal, you should be able to convert it to UTF-8 by adding the u8 prefix:
wb.load("a.xlsx", u8"пароль");
Closing for now. Please comment here if you're still having trouble opening workbooks with non-ASCII passwords.
Hi, I think std::string for password is wrong, because password must be uncode UTF-16. std::string holds UTF-8. Try use std::u16string.