-
Notifications
You must be signed in to change notification settings - Fork 0
/
utf8everywhere.cpp
46 lines (37 loc) · 1.53 KB
/
utf8everywhere.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <filesystem>
#include <format>
#include <fstream>
#include <string_view>
#include "utils.h"
#ifdef _WIN32
#include <Windows.h>
#endif
int main() {
#ifdef _WIN32
std::print(
"Active code page: {}\nOEM code page: {}\nConsole output code page: {}\n",
GetACP(), GetOEMCP(), GetConsoleOutputCP());
#endif
const std::filesystem::path OutputPath =
std::filesystem::current_path() / "ω😆.txt";
std::fstream File(OutputPath, std::fstream::out | std::fstream::trunc);
std::print(File, "Wingdings are still a thing! 📫👓🖉☯\n");
std::print("File created? {}\n",
std::filesystem::exists(OutputPath) ? "💪" : "💩");
const std::filesystem::path OutputPathUpperCase =
std::filesystem::current_path() / "Ω😆.txt";
std::print("Greek is case-sensitive? {}\n",
!std::filesystem::exists(OutputPathUpperCase) ? "✓" : "💔");
std::print("Paths are {}equivalent! \n",
OutputPath == OutputPathUpperCase ? "" : "NOT ");
for (std::string_view View : {"µ", "a", "🐱", "\uFEFF"})
vu::describeCodePoint(View);
static_assert(std::string_view("\u00B5") == std::string_view("µ"));
static_assert(std::string_view("\u03BC") == std::string_view("μ"));
static_assert(std::string_view("µ") != std::string_view("μ"));
constexpr auto MoralDilemma =
"How do I spell my name now, Andr\u00E9, Andre\u0301, or Andre\u02CA?\n";
std::print(File, MoralDilemma);
std::print(MoralDilemma);
static_assert(std::string_view("é") == std::string_view("\u00E9"));
}