lidavidm commented on code in PR #47771:
URL: https://github.com/apache/arrow/pull/47771#discussion_r2418227009


##########
cpp/src/arrow/flight/sql/odbc/CMakeLists.txt:
##########
@@ -33,6 +33,8 @@ else()
   set(ODBCINST odbcinst)
 endif()
 
+add_definitions(-DUNICODE=1)

Review Comment:
   Can we use target_add_definitions?



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc:
##########
@@ -31,18 +34,20 @@ std::string SystemTrustStore::GetNext() const {
   CryptBinaryToString(p_context_->pbCertEncoded, p_context_->cbCertEncoded,
                       CRYPT_STRING_BASE64HEADER, nullptr, &size);
 
-  std::string cert;
-  cert.resize(size);
+  std::wstring wCert;
+  wCert.resize(size);
   CryptBinaryToString(p_context_->pbCertEncoded, p_context_->cbCertEncoded,
-                      CRYPT_STRING_BASE64HEADER, &cert[0], &size);
-  cert.resize(size);
+                      CRYPT_STRING_BASE64HEADER, &wCert[0], &size);
+  wCert.resize(size);
+
+  std::string cert = arrow::util::WideStringToUTF8(wCert).ValueOr("");

Review Comment:
   Why is this using wide strings in the first place?



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/system_trust_store.cc:
##########
@@ -31,18 +34,20 @@ std::string SystemTrustStore::GetNext() const {
   CryptBinaryToString(p_context_->pbCertEncoded, p_context_->cbCertEncoded,
                       CRYPT_STRING_BASE64HEADER, nullptr, &size);
 
-  std::string cert;
-  cert.resize(size);
+  std::wstring wcert;
+  wcert.resize(size);
   CryptBinaryToString(p_context_->pbCertEncoded, p_context_->cbCertEncoded,
-                      CRYPT_STRING_BASE64HEADER, &cert[0], &size);
-  cert.resize(size);
+                      CRYPT_STRING_BASE64HEADER, &wcert[0], &size);
+  wcert.resize(size);
+
+  std::string cert = arrow::util::WideStringToUTF8(wcert).ValueOr("");

Review Comment:
   If the output is a base64 string, can we directly use CryptBinaryToStringA?



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.h:
##########
@@ -59,6 +59,7 @@ class Configuration {
   void Clear();
   bool IsSet(const std::string_view& key) const;
   const std::string& Get(const std::string_view& key) const;
+  void Set(const std::string_view& key, const std::wstring& wValue);

Review Comment:
   ```suggestion
     void Set(const std::string_view& key, const std::wstring& wide_value);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to