Skip to content

Instantly share code, notes, and snippets.

View lyandut's full-sized avatar
🕊️
Focusing

Yan Li lyandut

🕊️
Focusing
View GitHub Profile
@lyandut
lyandut / 0_gbk2utf8.cpp
Last active March 3, 2022 04:34
Encoding Conversion for C++ (deprecated in C++17).
#include <codecvt>
std::string name = "李研"; // GBK encoding
std::wstring w_name = string2wstring(name, ".936");
std::string utf8_name = wstring2utf8(w_name);
@lyandut
lyandut / 0_learn_json.cpp
Last active July 7, 2023 10:55
Some examples of nlohmann/json (JSON for Modern C++).
#include <iostream>
#include <cassert>
#include <iomanip>
#include <fstream>
#include "single_include/nlohmann/json.hpp"
using namespace std;
using json = nlohmann::json;
// add snippnets here.