<commit_before>#include <sstream>
#include <string>
#include <locale>
#include <codecvt>
#include <vector>
#include <csignal>
#include <memory>

#include "utils.hpp"

std::string enquote(std::string s) {
	std::ostringstream result;
	result << "\"";
	for (char c : s) {
		switch (c) {
		case '\'':
			result << "\\'";
			break;
		case '"':
			result << "\\\"";
			break;
		case '?':
			result << "\\?";
			break;
		case '\\':
			result << "\\\\";
			break;
		case '\a':
			result << "\\a";
			break;
		case '\b':
			result << "\\b";
			break;
		case '\f':
			result << "\\f";
			break;
		case '\n':
			result << "\\n";
			break;
		case '\r':
			result << "\\r";
			break;
		case '\t':
			result << "\\t";
			break;
		case '\v':
			result << "\\v";
			break;
		default:
			result << c;
		}
	}
	result << "\"";
	return result.str();
}

#if _MSC_VER == 1900

std::string to_utf8(const std::u16string &s)
{<commit_msg>enable unicode string conversion hacks for _MSC_VER == 1910<commit_after>#include <sstream>
#include <string>
#include <locale>
#include <codecvt>
#include <vector>
#include <csignal>
#include <memory>

#include "utils.hpp"

std::string enquote(std::string s) {
	std::ostringstream result;
	result << "\"";
	for (char c : s) {
		switch (c) {
		case '\'':
			result << "\\'";
			break;
		case '"':
			result << "\\\"";
			break;
		case '?':
			result << "\\?";
			break;
		case '\\':
			result << "\\\\";
			break;
		case '\a':
			result << "\\a";
			break;
		case '\b':
			result << "\\b";
			break;
		case '\f':
			result << "\\f";
			break;
		case '\n':
			result << "\\n";
			break;
		case '\r':
			result << "\\r";
			break;
		case '\t':
			result << "\\t";
			break;
		case '\v':
			result << "\\v";
			break;
		default:
			result << c;
		}
	}
	result << "\"";
	return result.str();
}

#if _MSC_VER == 1900 || _MSC_VER == 1910

std::string to_utf8(const std::u16string &s)
{
{'fraction_non_alphanumeric': 0.23678646934460887, 'fraction_numerical': 0.011627906976744186, 'mean_word_length': 2.473394495412844, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7190519', 'n_tokens_mistral': 901, 'n_tokens_neox': 737, 'n_words': 185}