From 93d8fccd51a704c4accd535743a963ad0ca5a274 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 5 Jan 2021 16:49:21 +0100 Subject: createFromUserInput(): accept leading white space (fixes #2498) --- src/iso19111/io.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp index dc51c5d9..c0844608 100644 --- a/src/iso19111/io.cpp +++ b/src/iso19111/io.cpp @@ -6132,6 +6132,12 @@ static BaseObjectNNPtr createFromUserInput(const std::string &text, const DatabaseContextPtr &dbContext, bool usePROJ4InitRules, PJ_CONTEXT *ctx) { + std::size_t idxFirstCharNotSpace = text.find_first_not_of(" \t\r\n"); + if (idxFirstCharNotSpace > 0 && idxFirstCharNotSpace != std::string::npos) { + return createFromUserInput(text.substr(idxFirstCharNotSpace), dbContext, + usePROJ4InitRules, ctx); + } + if (!text.empty() && text[0] == '{') { json j; try { -- cgit v1.2.3