You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2018/03/21 18:29:13 UTC
[1/6] logging-log4cxx git commit: LOGCXX-369: Make code a bit more
readable before using it as base for decodingtest.
Repository: logging-log4cxx
Updated Branches:
refs/heads/master 78c60461f -> 5f8251869
LOGCXX-369: Make code a bit more readable before using it as base for decodingtest.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/eef00c52
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/eef00c52
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/eef00c52
Branch: refs/heads/master
Commit: eef00c5232c0285dec72a78b53e1bc33560549f1
Parents: a85b85f
Author: Thorsten Schöning <ts...@am-soft.de>
Authored: Wed Mar 21 10:27:05 2018 +0100
Committer: Thorsten Schöning <ts...@am-soft.de>
Committed: Wed Mar 21 10:27:05 2018 +0100
----------------------------------------------------------------------
src/test/cpp/encodingtest.cpp | 70 ++++++++++++++++++++++++++------------
1 file changed, 49 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/eef00c52/src/test/cpp/encodingtest.cpp
----------------------------------------------------------------------
diff --git a/src/test/cpp/encodingtest.cpp b/src/test/cpp/encodingtest.cpp
index ce0ab54..8faf033 100644
--- a/src/test/cpp/encodingtest.cpp
+++ b/src/test/cpp/encodingtest.cpp
@@ -39,8 +39,8 @@ using namespace log4cxx::helpers;
/**
* Tests support for encoding specification.
- *
- *
+ *
+ *
*/
LOGUNIT_CLASS(EncodingTest) {
LOGUNIT_TEST_SUITE(EncodingTest);
@@ -65,9 +65,12 @@ public:
*/
void testASCII() {
LoggerPtr root(Logger::getRootLogger());
- configure(root, LOG4CXX_STR("output/ascii.log"), LOG4CXX_STR("US-ASCII"));
+
+ configure(root, LOG4CXX_STR("output/encoding/ascii.log"),
+ LOG4CXX_STR("US-ASCII"));
common(root);
- BinaryCompare::compare("output/ascii.log", "witness/encoding/ascii.log");
+
+ BinaryCompare::compare("output/encoding/ascii.log", "witness/encoding/ascii.log");
}
/**
@@ -75,9 +78,13 @@ public:
*/
void testLatin1() {
LoggerPtr root(Logger::getRootLogger());
- configure(root, LOG4CXX_STR("output/latin1.log"), LOG4CXX_STR("iso-8859-1"));
+
+ configure(root, LOG4CXX_STR("output/encoding/latin1.log"),
+ LOG4CXX_STR("iso-8859-1"));
common(root);
- BinaryCompare::compare("output/latin1.log", "witness/encoding/latin1.log");
+
+ BinaryCompare::compare( "output/encoding/latin1.log",
+ "witness/encoding/latin1.log");
}
/**
@@ -85,9 +92,13 @@ public:
*/
void testUtf8() {
LoggerPtr root(Logger::getRootLogger());
- configure(root, LOG4CXX_STR("output/UTF-8.log"), LOG4CXX_STR("UTF-8"));
+
+ configure(root, LOG4CXX_STR("output/encoding/UTF-8.log"),
+ LOG4CXX_STR("UTF-8"));
common(root);
- BinaryCompare::compare("output/UTF-8.log", "witness/encoding/UTF-8.log");
+
+ BinaryCompare::compare( "output/encoding/UTF-8.log",
+ "witness/encoding/UTF-8.log");
}
/**
@@ -95,9 +106,13 @@ public:
*/
void testUtf16() {
LoggerPtr root(Logger::getRootLogger());
- configure(root, LOG4CXX_STR("output/UTF-16.log"), LOG4CXX_STR("UTF-16"));
+
+ configure(root, LOG4CXX_STR("output/encoding/UTF-16.log"),
+ LOG4CXX_STR("UTF-16"));
common(root);
- BinaryCompare::compare("output/UTF-16.log", "witness/encoding/UTF-16.log");
+
+ BinaryCompare::compare( "output/encoding/UTF-16.log",
+ "witness/encoding/UTF-16.log");
}
/**
@@ -105,9 +120,13 @@ public:
*/
void testUtf16BE() {
LoggerPtr root(Logger::getRootLogger());
- configure(root, LOG4CXX_STR("output/UTF-16BE.log"), LOG4CXX_STR("UTF-16BE"));
+
+ configure(root, LOG4CXX_STR("output/encoding/UTF-16BE.log"),
+ LOG4CXX_STR("UTF-16BE"));
common(root);
- BinaryCompare::compare("output/UTF-16BE.log", "witness/encoding/UTF-16BE.log");
+
+ BinaryCompare::compare( "output/encoding/UTF-16BE.log",
+ "witness/encoding/UTF-16BE.log");
}
/**
@@ -115,9 +134,13 @@ public:
*/
void testUtf16LE() {
LoggerPtr root(Logger::getRootLogger());
- configure(root, LOG4CXX_STR("output/UTF-16LE.log"), LOG4CXX_STR("UTF-16LE"));
+
+ configure(root, LOG4CXX_STR("output/encoding/UTF-16LE.log"),
+ LOG4CXX_STR("UTF-16LE"));
common(root);
- BinaryCompare::compare("output/UTF-16LE.log", "witness/encoding/UTF-16LE.log");
+
+ BinaryCompare::compare( "output/encoding/UTF-16LE.log",
+ "witness/encoding/UTF-16LE.log");
}
/**
@@ -127,18 +150,22 @@ public:
* @param encoding encoding
*/
private:
- void configure(LoggerPtr& logger,
- const LogString& filename, const LogString& encoding) {
+ void configure( LoggerPtr& logger,
+ const LogString& filename,
+ const LogString& encoding) {
+ FileAppenderPtr appender(new FileAppender());
PatternLayoutPtr layout(new PatternLayout());
+ Pool p;
+
layout->setConversionPattern(LOG4CXX_STR("%p - %m\n"));
- Pool p;
layout->activateOptions(p);
- FileAppenderPtr appender(new FileAppender());
- appender->setFile(filename);
- appender->setEncoding(encoding);
+
appender->setAppend(false);
+ appender->setEncoding(encoding);
+ appender->setFile(filename);
appender->setLayout(layout);
appender->activateOptions(p);
+
logger->addAppender(appender);
logger->setLevel(Level::getInfo());
}
@@ -149,14 +176,15 @@ public:
*/
void common(LoggerPtr& logger) {
logger->info("Hello, World");
+
// pi can be encoded in iso-8859-1
const wchar_t pi[] = { 0x00B9, 0 };
logger->info(pi);
+
// arbitrary, hopefully meaningless, characters from
// Latin, Arabic, Armenian, Bengali, CJK and Cyrillic
const wchar_t greeting[] = { L'A', 0x0605, 0x0530, 0x986, 0x4E03, 0x400, 0 };
logger->info(greeting);
-
}
};
[6/6] logging-log4cxx git commit: Merge branch logcxx_369,
which additionally closes
https://github.com/apache/logging-log4cxx/pull/4.
Posted by ts...@apache.org.
Merge branch logcxx_369, which additionally closes https://github.com/apache/logging-log4cxx/pull/4.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/5f825186
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/5f825186
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/5f825186
Branch: refs/heads/master
Commit: 5f825186936a1876f92b88b371334ff26e997287
Parents: 78c6046 e6c8f59
Author: Thorsten Schöning <ts...@am-soft.de>
Authored: Wed Mar 21 19:24:53 2018 +0100
Committer: Thorsten Schöning <ts...@am-soft.de>
Committed: Wed Mar 21 19:24:53 2018 +0100
----------------------------------------------------------------------
src/changes/changes.xml | 2 +
src/main/cpp/charsetdecoder.cpp | 2 +-
src/test/cpp/decodingtest.cpp | 151 ++++++++++++++++++++
src/test/cpp/encodingtest.cpp | 71 ++++++---
src/test/resources/input/decoding/Makefile.am | 31 ++++
src/test/resources/input/decoding/UTF-16.txt | Bin 0 -> 18 bytes
src/test/resources/input/decoding/UTF-16BE.txt | Bin 0 -> 16 bytes
src/test/resources/input/decoding/UTF-16LE.txt | Bin 0 -> 16 bytes
src/test/resources/input/decoding/UTF-8.txt | 1 +
src/test/resources/input/decoding/ascii.txt | 1 +
src/test/resources/input/decoding/latin1.txt | 1 +
11 files changed, 238 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
[2/6] logging-log4cxx git commit: LOGCXX-369: Make code a bit more
readable before using it as base for decodingtest.
Posted by ts...@apache.org.
LOGCXX-369: Make code a bit more readable before using it as base for decodingtest.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/1f226dc1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/1f226dc1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/1f226dc1
Branch: refs/heads/master
Commit: 1f226dc1663e22408b6bce2086b86549975ff006
Parents: eef00c5
Author: Thorsten Schöning <ts...@am-soft.de>
Authored: Wed Mar 21 11:00:33 2018 +0100
Committer: Thorsten Schöning <ts...@am-soft.de>
Committed: Wed Mar 21 11:00:33 2018 +0100
----------------------------------------------------------------------
src/test/cpp/encodingtest.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/1f226dc1/src/test/cpp/encodingtest.cpp
----------------------------------------------------------------------
diff --git a/src/test/cpp/encodingtest.cpp b/src/test/cpp/encodingtest.cpp
index 8faf033..3b04011 100644
--- a/src/test/cpp/encodingtest.cpp
+++ b/src/test/cpp/encodingtest.cpp
@@ -70,7 +70,8 @@ public:
LOG4CXX_STR("US-ASCII"));
common(root);
- BinaryCompare::compare("output/encoding/ascii.log", "witness/encoding/ascii.log");
+ BinaryCompare::compare( "output/encoding/ascii.log",
+ "witness/encoding/ascii.log");
}
/**
[5/6] logging-log4cxx git commit: LOGCXX-369: Record fixed for 369
and 399.
Posted by ts...@apache.org.
LOGCXX-369: Record fixed for 369 and 399.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/e6c8f59f
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/e6c8f59f
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/e6c8f59f
Branch: refs/heads/master
Commit: e6c8f59f7deed62a0215b2c89cdd6bcc6c22a2ef
Parents: 71e9a3f
Author: Thorsten Schöning <ts...@am-soft.de>
Authored: Wed Mar 21 13:54:46 2018 +0100
Committer: Thorsten Schöning <ts...@am-soft.de>
Committed: Wed Mar 21 13:54:46 2018 +0100
----------------------------------------------------------------------
src/changes/changes.xml | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/e6c8f59f/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fbec857..3f8591b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,10 +48,12 @@
<action issue="LOGCXX-412" type="fix">Log4cxx doesn't roll normally when working under multiple processes environment</action>
<action issue="LOGCXX-411" type="fix">Crash when logging on multiple threads.</action>
<action issue="LOGCXX-400" type="fix">C++11 does not allow char literals with highest bit set unless cast</action>
+ <action issue="LOGCXX-399" type="fix">Non-ascii character output wrong.</action>
<action issue="LOGCXX-394" type="fix">Levels are not thread safe</action>
<action issue="LOGCXX-388" type="fix">Hierarchy::updateParents loops forever on illegal logger-name like '.logger1'</action>
<action issue="LOGCXX-382" type="fix">Mingw build type conversion error</action>
<action issue="LOGCXX-381" type="fix">Pkgconfig can't find dependencies properly if log4cxx built statically</action>
+ <action issue="LOGCXX-369" type="fix">Load Properties File Fails When There Are multibyte Characters in the Path</action>
<action issue="LOGCXX-368" type="fix">method and class name functions not properly implemented</action>
<action issue="LOGCXX-367" type="fix">Build fails on Linux with g++ 4.4</action>
<action issue="LOGCXX-366" type="fix">Errors when compile log4cxx 0.10.0 under Win7 x64 with Visual Studio 2010 (due to Christian Boos and Feng Nan)</action>
[3/6] logging-log4cxx git commit: LOGCXX-369: decodingtest added to
try to reproduce the mentioned problem in MbstowcsCharsetDecoder. mbsrtowcs
is not available on all platforms,
so the current commit works for those without it, like my C++-Builder.
Posted by ts...@apache.org.
LOGCXX-369: decodingtest added to try to reproduce the mentioned problem in MbstowcsCharsetDecoder. mbsrtowcs is not available on all platforms, so the current commit works for those without it, like my C++-Builder.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/818be252
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/818be252
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/818be252
Branch: refs/heads/master
Commit: 818be2527e2f1ea2c9849ff89d78101ff8448c91
Parents: 1f226dc
Author: Thorsten Schöning <ts...@am-soft.de>
Authored: Wed Mar 21 13:30:00 2018 +0100
Committer: Thorsten Schöning <ts...@am-soft.de>
Committed: Wed Mar 21 13:30:00 2018 +0100
----------------------------------------------------------------------
src/test/cpp/decodingtest.cpp | 151 ++++++++++++++++++++
src/test/resources/input/decoding/Makefile.am | 31 ++++
src/test/resources/input/decoding/UTF-16.txt | Bin 0 -> 18 bytes
src/test/resources/input/decoding/UTF-16BE.txt | Bin 0 -> 16 bytes
src/test/resources/input/decoding/UTF-16LE.txt | Bin 0 -> 16 bytes
src/test/resources/input/decoding/UTF-8.txt | 1 +
src/test/resources/input/decoding/ascii.txt | 1 +
src/test/resources/input/decoding/latin1.txt | 1 +
8 files changed, 185 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/cpp/decodingtest.cpp
----------------------------------------------------------------------
diff --git a/src/test/cpp/decodingtest.cpp b/src/test/cpp/decodingtest.cpp
new file mode 100644
index 0000000..61f90b7
--- /dev/null
+++ b/src/test/cpp/decodingtest.cpp
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ */
+
+
+#include <string>
+
+#include <log4cxx/helpers/charsetdecoder.h>
+#include <log4cxx/helpers/exception.h>
+#include <log4cxx/helpers/fileinputstream.h>
+#include <log4cxx/helpers/inputstreamreader.h>
+#include <log4cxx/helpers/pool.h>
+#include <log4cxx/helpers/transcoder.h>
+#include <log4cxx/logstring.h>
+
+#include "logunit.h"
+//
+// If there is no support for wchar_t logging then
+// there is not a consistent way to get the test characters compared.
+//
+#if LOG4CXX_WCHAR_T_API
+
+using namespace log4cxx;
+using namespace log4cxx::helpers;
+
+/**
+ * Tests support for decoding specification.
+ *
+ * The lib provides multiple different decoders and decides which to use by default on compile time.
+ * This test uses the same checks like {@link CharsetDecoder#createDefaultDecoder} to decide which
+ * checks to run actually, so that some input file with some encoded text according to the decoder
+ * in use is read and the contents compared to some witness. Because of different decoders not all
+ * files have the same content, e.g. the ASCII-only decoder can't deal with Unicode chars obviously.
+ *
+ * This test is based on encodingtest and uses that witnesses, especially the hard coded strings for
+ * greeting and pi. We only combine it into one in the former mentioned order, divided by a space.
+ *
+ * @see LOGCXX-369
+ * @see LOGCXX-399
+ */
+LOGUNIT_CLASS(DecodingTest) {
+ LOGUNIT_TEST_SUITE(DecodingTest);
+#if LOG4CXX_CHARSET_USASCII
+ LOGUNIT_TEST(testASCII);
+#elif LOG4CXX_CHARSET_ISO88591 || defined(_WIN32_WCE)
+ LOGUNIT_TEST(testLatin1);
+#elif LOG4CXX_CHARSET_UTF8
+ LOGUNIT_TEST(testUtf8);
+#elif LOG4CXX_LOGCHAR_IS_WCHAR && LOG4CXX_HAS_MBSRTOWCS
+ LOGUNIT_TEST(testUtf16);
+ LOGUNIT_TEST(testUtf16LE);
+ LOGUNIT_TEST(testUtf16BE);
+#else
+ // LocaleCharsetDecoder, so it's difficult to provide a file working for e.g. windows-1252
+ // as well as something completely different.
+ LOGUNIT_TEST(testASCII);
+#endif
+ LOGUNIT_TEST_SUITE_END();
+public:
+ /**
+ * Test us-ascii decoding.
+ */
+ void testASCII() {
+ const wchar_t witness[] = { L'A', 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x0020, 0x003F, 0 };
+
+ testImpl(LOG4CXX_STR("ascii.txt"), witness);
+
+ }
+
+ /**
+ * Test iso-8859-1 decoding.
+ */
+ void testLatin1() {
+ const wchar_t witness[] = { L'A', 0x003F, 0x003F, 0x003F, 0x003F, 0x003F, 0x0020, 0x00B9, 0 };
+
+ testImpl(LOG4CXX_STR("latin1.txt"), witness);
+ }
+
+ /**
+ * Test utf-8 decoding.
+ */
+ void testUtf8() {
+ const wchar_t witness[] = { L'A', 0x0605, 0x0530, 0x986, 0x4E03, 0x0400, 0x0020, 0x00B9, 0 };
+
+ testImpl(LOG4CXX_STR("UTF-8.txt"), witness);
+ }
+
+ /**
+ * Test utf-16 decoding.
+ */
+ void testUtf16() {
+ const wchar_t witness[] = { L'A', 0x0605, 0x0530, 0x986, 0x4E03, 0x0400, 0x0020, 0x00B9, 0 };
+
+ testImpl(LOG4CXX_STR("UTF-16.txt"), witness);
+ }
+
+ /**
+ * Test utf-16be decoding.
+ */
+ void testUtf16BE() {
+ const wchar_t witness[] = { L'A', 0x0605, 0x0530, 0x986, 0x4E03, 0x0400, 0x0020, 0x00B9, 0 };
+
+ testImpl(LOG4CXX_STR("UTF-16BE.txt"), witness);
+ }
+
+ /**
+ * Test utf16-le decoding.
+ */
+ void testUtf16LE() {
+ const wchar_t witness[] = { L'A', 0x0605, 0x0530, 0x986, 0x4E03, 0x0400, 0x0020, 0x00B9, 0 };
+
+ testImpl(LOG4CXX_STR("UTF-16LE.txt"), witness);
+ }
+
+ private:
+ void testImpl(
+ const LogString& fileName,
+ const wchar_t* witness) {
+ CharsetDecoderPtr decoder(CharsetDecoder::getDefaultDecoder());
+ LogString lsContent;
+ std::wstring wsContent;
+ LogString path(LOG4CXX_STR("input/decoding/") + fileName);
+ Pool pool;
+
+ FileInputStreamPtr fis( new FileInputStream(path));
+ InputStreamReaderPtr isReader(new InputStreamReader(fis, decoder));
+
+ lsContent.assign(isReader->read(pool));
+ Transcoder::encode(lsContent, wsContent);
+
+ LOGUNIT_ASSERT_EQUAL((std::wstring) witness, wsContent);
+ }
+};
+
+LOGUNIT_TEST_SUITE_REGISTRATION(DecodingTest);
+
+#endif
+
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/Makefile.am
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/Makefile.am b/src/test/resources/input/decoding/Makefile.am
new file mode 100644
index 0000000..c1a34ad
--- /dev/null
+++ b/src/test/resources/input/decoding/Makefile.am
@@ -0,0 +1,31 @@
+# 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.
+#
+EXTRA_DIST = \
+ ascii.txt \
+ latin1.txt \
+ UTF-16BE.txt \
+ UTF-16LE.txt \
+ UTF-16.txt \
+ UTF-8.txt
+
+# if we are building in a separate build tree, then prepare all necessary links
+all-local:
+ @if test "$(top_srcdir)" != "$(top_builddir)"; then \
+ echo "Symlinking test suite data files ..." ; \
+ for file in $(EXTRA_DIST); do \
+ test -a "$$file" || $(LN_S) "$(srcdir)/$$file"; \
+ done \
+ fi
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/UTF-16.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/UTF-16.txt b/src/test/resources/input/decoding/UTF-16.txt
new file mode 100644
index 0000000..3e9d406
Binary files /dev/null and b/src/test/resources/input/decoding/UTF-16.txt differ
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/UTF-16BE.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/UTF-16BE.txt b/src/test/resources/input/decoding/UTF-16BE.txt
new file mode 100644
index 0000000..47d2242
Binary files /dev/null and b/src/test/resources/input/decoding/UTF-16BE.txt differ
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/UTF-16LE.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/UTF-16LE.txt b/src/test/resources/input/decoding/UTF-16LE.txt
new file mode 100644
index 0000000..f497fb9
Binary files /dev/null and b/src/test/resources/input/decoding/UTF-16LE.txt differ
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/UTF-8.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/UTF-8.txt b/src/test/resources/input/decoding/UTF-8.txt
new file mode 100644
index 0000000..04b248f
--- /dev/null
+++ b/src/test/resources/input/decoding/UTF-8.txt
@@ -0,0 +1 @@
+Aআ七Ѐ ¹
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/ascii.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/ascii.txt b/src/test/resources/input/decoding/ascii.txt
new file mode 100644
index 0000000..f0327b1
--- /dev/null
+++ b/src/test/resources/input/decoding/ascii.txt
@@ -0,0 +1 @@
+A????? ?
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/818be252/src/test/resources/input/decoding/latin1.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/input/decoding/latin1.txt b/src/test/resources/input/decoding/latin1.txt
new file mode 100644
index 0000000..9d8837b
--- /dev/null
+++ b/src/test/resources/input/decoding/latin1.txt
@@ -0,0 +1 @@
+A????? �
\ No newline at end of file
[4/6] logging-log4cxx git commit: mbsrtowcs() returns the number of
wide char, but not the source in string length.
Posted by ts...@apache.org.
mbsrtowcs() returns the number of wide char,but not the source in string length.
If there have n chinese characters,the log will output more last n characters.
Project: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/commit/71e9a3fc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/tree/71e9a3fc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4cxx/diff/71e9a3fc
Branch: refs/heads/master
Commit: 71e9a3fc21f4abdab4b5e2beecd0ae3ac1ee25da
Parents: 818be25
Author: wzf <te...@163.com>
Authored: Wed Mar 21 14:34:41 2018 +0800
Committer: Thorsten Schöning <ts...@am-soft.de>
Committed: Wed Mar 21 13:52:57 2018 +0100
----------------------------------------------------------------------
src/main/cpp/charsetdecoder.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4cxx/blob/71e9a3fc/src/main/cpp/charsetdecoder.cpp
----------------------------------------------------------------------
diff --git a/src/main/cpp/charsetdecoder.cpp b/src/main/cpp/charsetdecoder.cpp
index d288725..aa5a6a0 100644
--- a/src/main/cpp/charsetdecoder.cpp
+++ b/src/main/cpp/charsetdecoder.cpp
@@ -177,7 +177,7 @@ namespace log4cxx
break;
} else {
stat = append(out, buf);
- in.position(in.position() + converted);
+ in.position(in.position() + requested);
}
}
}