From a431fe8a8dfbbe121a30c66df0424be6351ae9ff Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 28 Jan 2020 20:44:28 +0300 Subject: Validate that values submitted to CI and submission services contain UTF-8 encoded graphic characters only --- bdep/utility.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bdep/utility.cxx') diff --git a/bdep/utility.cxx b/bdep/utility.cxx index 5a547eb..0ec3233 100644 --- a/bdep/utility.cxx +++ b/bdep/utility.cxx @@ -297,4 +297,18 @@ namespace bdep r.push_back ("}"); } } + + void + validate_utf8_graphic (const string& s, const char* what, const char* opt) + { + if (!utf8 (s, codepoint_types::graphic)) + { + diag_record dr (fail); + dr << what << " '" << s << "' is not UTF-8 encoded or contains " + << "non-graphic Unicode codepoints"; + + if (opt != nullptr) + dr << info << "consider using " << opt << " to override"; + } + } } -- cgit v1.1