summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-01-02 19:18:16 +0000
committerChris Wilson <chris+github@qwirx.com>2015-01-02 19:18:16 +0000
commit72d99a97142057b600ce981b85030ca4eb0da992 (patch)
tree24b74a85a6c36b05dd4e40052695a2a99128c4b4 /test
parentd9f7714287aba5cc5138df0593b0495a81f96d98 (diff)
Fix test to handle console encoding already in UTF-8.
Diffstat (limited to 'test')
-rw-r--r--test/bbackupd/testbbackupd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp
index 3b4a82f4..5c3303c2 100644
--- a/test/bbackupd/testbbackupd.cpp
+++ b/test/bbackupd/testbbackupd.cpp
@@ -2477,7 +2477,10 @@ bool test_unicode_filenames_can_be_backed_up()
// We have no guarantee that a random Unicode string can be
// represented in the user's character set, so we go the
// other way, taking three random characters from the
- // character set and converting them to Unicode.
+ // character set and converting them to Unicode. Unless the
+ // console codepage is CP_UTF8, in which case our random
+ // characters are not valid, so we use the UTF8 version
+ // of them instead.
//
// We hope that these characters are valid in most
// character sets, but they probably are not in multibyte
@@ -2497,7 +2500,8 @@ bool test_unicode_filenames_can_be_backed_up()
// accented characters, which are supported in code page
// 850. Depending on your locale, YYMV (your yak may vomit).
- std::string foreignCharsNative("\x91\x9b\x86");
+ std::string foreignCharsNative = (GetConsoleCP() == CP_UTF8)
+ ? "\xc3\xa6\xc3\xb8\xc3\xa5" : "\x91\x9b\x86";
std::string foreignCharsUnicode;
TEST_THAT(ConvertConsoleToUtf8(foreignCharsNative.c_str(),
foreignCharsUnicode));