David PHAM-VAN

Fix Windows string encoding

@@ -2,6 +2,10 @@ @@ -2,6 +2,10 @@
2 2
3 ## 5.6.2 3 ## 5.6.2
4 4
  5 +- Fix Windows string encoding
  6 +
  7 +## 5.6.2
  8 +
5 - Update Linux and Windows pdfium libraries to 4706 9 - Update Linux and Windows pdfium libraries to 4706
6 - Remove extra scroll bars on desktop [Jonathan Salmon] 10 - Remove extra scroll bars on desktop [Jonathan Salmon]
7 11
@@ -6,7 +6,7 @@ description: > @@ -6,7 +6,7 @@ description: >
6 homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing 6 homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing
7 repository: https://github.com/DavBfr/dart_pdf 7 repository: https://github.com/DavBfr/dart_pdf
8 issue_tracker: https://github.com/DavBfr/dart_pdf/issues 8 issue_tracker: https://github.com/DavBfr/dart_pdf/issues
9 -version: 5.6.2 9 +version: 5.6.3
10 10
11 environment: 11 environment:
12 sdk: ">=2.12.0 <3.0.0" 12 sdk: ">=2.12.0 <3.0.0"
@@ -56,7 +56,7 @@ std::string toUtf8(TCHAR* tstr) { @@ -56,7 +56,7 @@ std::string toUtf8(TCHAR* tstr) {
56 } 56 }
57 57
58 std::wstring fromUtf8(std::string str) { 58 std::wstring fromUtf8(std::string str) {
59 - auto len = MultiByteToWideChar(CP_ACP, 0, str.c_str(), 59 + auto len = MultiByteToWideChar(CP_UTF8, 0, str.c_str(),
60 static_cast<int>(str.length()), nullptr, 0); 60 static_cast<int>(str.length()), nullptr, 0);
61 if (len <= 0) { 61 if (len <= 0) {
62 return false; 62 return false;
@@ -64,7 +64,7 @@ std::wstring fromUtf8(std::string str) { @@ -64,7 +64,7 @@ std::wstring fromUtf8(std::string str) {
64 64
65 auto wstr = std::wstring{}; 65 auto wstr = std::wstring{};
66 wstr.resize(len); 66 wstr.resize(len);
67 - MultiByteToWideChar(CP_ACP, 0, str.c_str(), static_cast<int>(str.length()), 67 + MultiByteToWideChar(CP_UTF8, 0, str.c_str(), static_cast<int>(str.length()),
68 &wstr[0], len); 68 &wstr[0], len);
69 69
70 return wstr; 70 return wstr;