Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #446: Save some file to UTF-8 (with BOM) encoding. #447

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/AppInstallerCLICore/TableOutput.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "ExecutionReporter.h"
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace AppInstaller::CLI::Execution
if (valueLength > col.MaxLength)
{
out << Utility::UTF8Substring(line[i], 0, col.MaxLength - 1);
out << "\xE2\x80\xA6"; // UTF8 encoding of ellipsis () character
out << "\xE2\x80\xA6"; // UTF8 encoding of ellipsis () character

if (col.SpaceAfter)
{
Expand Down
6 changes: 3 additions & 3 deletions src/AppInstallerCLITests/Strings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "TestCommon.h"
Expand All @@ -12,8 +12,8 @@ TEST_CASE("UTF8Length", "[strings]")
REQUIRE(UTF8Length("") == 0);
REQUIRE(UTF8Length("a") == 1);
REQUIRE(UTF8Length(" a b c ") == 7);
REQUIRE(UTF8Length("K\xC3\xA4se") == 4); // "K�se"
REQUIRE(UTF8Length("bye\xE2\x80\xA6") == 4); // "bye"
REQUIRE(UTF8Length("K\xC3\xA4se") == 4); // "Käse"
REQUIRE(UTF8Length("bye\xE2\x80\xA6") == 4); // "bye"
REQUIRE(UTF8Length("\xf0\x9f\xa6\x86") == 1); // [duck emoji]
REQUIRE(UTF8Length("\xf0\x9d\x85\xa0\xf0\x9d\x85\xa0") == 2); // [8th note][8th note]
}
Expand Down