You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/11/11 11:46:46 UTC

[GitHub] [nifi-minifi-cpp] bakaid commented on a change in pull request #678: MINIFICPP-1080 - Unicode conversion fixes and speedup

bakaid commented on a change in pull request #678: MINIFICPP-1080 - Unicode conversion fixes and speedup
URL: https://github.com/apache/nifi-minifi-cpp/pull/678#discussion_r344674566
 
 

 ##########
 File path: extensions/windows-event-log/wel/UnicodeConversion.h
 ##########
 @@ -0,0 +1,41 @@
+/**
+ * @file UnicodeConversion.h
+ * Unicode conversion functions
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <string>
+
+#include <atlbase.h>
+#include <atlconv.h>
+
+namespace org {
+  namespace apache {
+    namespace nifi {
+      namespace minifi {
+        namespace wel {
+          inline std::string to_string(const wchar_t* pChar) {
+            ATL::CW2A aString(pChar, CP_UTF8);
+            return std::string(aString);
 
 Review comment:
   Eventually I want this to be part of StringUtils, but while I have manually tested this with this particular processor, and it seems to work OK, I am not sure that
    - using ATL will not incur any issues
    - this works with various types Unicode strings (and malformatted UTF-16, incomplete surrogate pairs, etc.)
   Therefore I would be more comfortable keeping it here until it proves it works fine and only include it in our API after that - and then including util tests. I will create a follow-up issue for this.
   Until then this is a helper for this extension, which are included in the wel namespace. Once we transition to StringUtils, this file will be easily removable.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services