From 2b221fec818efcae5e6b2902aeebf6df5e967083 Mon Sep 17 00:00:00 2001 From: Alessandro Bettarini Date: Sat, 7 Sep 2019 11:32:49 +0200 Subject: [PATCH] Prevent throwing exception when encountering country code 10485 --- source/detail/number_format/number_formatter.cpp | 3 ++- source/detail/number_format/number_formatter.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/detail/number_format/number_formatter.cpp b/source/detail/number_format/number_formatter.cpp index 5b0d5d49..a324f9cc 100644 --- a/source/detail/number_format/number_formatter.cpp +++ b/source/detail/number_format/number_formatter.cpp @@ -50,7 +50,7 @@ const std::unordered_map known_locales() {0x457, "Konkani"}, {0x458, "Manipuri"}, {0x459, "Sindhi"}, {0x460, "Kashmiri"}, {0x461, "Nepali"}, {0x462, "Frisian - Netherlands"}, {0x464, "Filipino"}, {0x465, "Divehi; Dhivehi; Maldivian"}, {0x466, "Edo"}, {0x470, "Igbo - Nigeria"}, {0x474, "Guarani - Paraguay"}, {0x476, "Latin"}, - {0x477, "Somali"}, {0x481, "Maori"}, {0x801, "Arabic - Iraq"}, {0x804, "Chinese - China"}, + {0x477, "Somali"}, {0x481, "Maori"}, {0x485, "sah-RU"}, {0x801, "Arabic - Iraq"}, {0x804, "Chinese - China"}, {0x807, "German - Switzerland"}, {0x809, "English - Great Britain"}, {0x810, "Italian - Switzerland"}, {0x813, "Dutch - Belgium"}, {0x814, "Norwegian - Nynorsk"}, {0x816, "Portuguese - Portugal"}, {0x818, "Romanian - Moldova"}, {0x819, "Russian - Moldova"}, {0x843, "Uzbek - Cyrillic"}, @@ -1066,6 +1066,7 @@ std::pair number_format_parser::locale_from_string(c } auto country_code = std::stoi(country_code_string, nullptr, 16); + country_code &= 0xFFFF; for (const auto &known_locale : known_locales()) { diff --git a/source/detail/number_format/number_formatter.hpp b/source/detail/number_format/number_formatter.hpp index 4c3e1492..e8662f68 100644 --- a/source/detail/number_format/number_formatter.hpp +++ b/source/detail/number_format/number_formatter.hpp @@ -172,6 +172,7 @@ enum class format_locale latin = 0x476, somali = 0x477, maori = 0x481, + yakut = 0x485, arabic_iraq = 0x801, chinese_china = 0x804, german_switzerland = 0x807,