From d65642ddf6c623d3a6074ed1adaefef028ead928 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Wed, 17 May 2017 11:45:27 +0900 Subject: [PATCH] add locale settings --- toml/parser.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toml/parser.hpp b/toml/parser.hpp index 27a6a99..56fe4e9 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace toml { @@ -1058,6 +1059,8 @@ struct parse_data template> toml::Table parse(std::basic_istream& is) { + const auto curloc = is.getloc(); + is.imbue(std::locale("en_US.utf-8")); const auto initial = is.tellg(); is.seekg(0, std::ios::end); const auto eofpos = is.tellg(); @@ -1065,6 +1068,7 @@ toml::Table parse(std::basic_istream& is) is.seekg(initial); std::vector contents(size); is.read(contents.data(), size); + is.imbue(curloc); return parse_data::invoke(contents.cbegin(), contents.cend()); }