You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/29 10:26:04 UTC

[GitHub] [arrow] milesgranger commented on a diff in pull request #14764: ARROW-18123: [C++] Multi-byte characters in file names write table

milesgranger commented on code in PR #14764:
URL: https://github.com/apache/arrow/pull/14764#discussion_r1034568038


##########
cpp/src/arrow/util/uri.cc:
##########
@@ -245,19 +256,25 @@ const std::string& Uri::ToString() const { return impl_->string_rep_; }
 Status Uri::Parse(const std::string& uri_string) {
   impl_->Reset();
 
-  const auto& s = impl_->KeepString(uri_string);
-  impl_->string_rep_ = s;
-  const char* error_pos;
-  if (uriParseSingleUriExA(&impl_->uri_, s.data(), s.data() + s.size(), &error_pos) !=
+  std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
+  std::wstring wide_uri = converter.from_bytes(uri_string);
+  std::wcout << "Wide URI: " << wide_uri << std::endl;
+
+  const auto& s = impl_->KeepString(wide_uri);
+  impl_->string_rep_ = converter.to_bytes(s);
+
+  const wchar_t* error_pos;
+  if (uriParseSingleUriExW(&impl_->uri_, s.data(), s.data() + s.size(), &error_pos) !=
       URI_SUCCESS) {
-    return Status::Invalid("Cannot parse URI: '", uri_string, "'");
+    return Status::Invalid("Cannot parse URI: '", uri_string, "' at: '",

Review Comment:
   Hi @pitrou, I know most of the PR is a bit of a mess, but I was thinking this specific area needed to have `wstring` support to parse the example in the issue (`δΎ‹.parquet`) but while it now compiles, it still fails to parse it. And I'm out of ideas now. :sweat_smile: 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org