From 74c10e06aa63161349def47738afcca7f398f330 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 1 May 2017 17:34:25 +0200 Subject: [PATCH] Do not add symbols twice to Encoding::symbolsList() Also sort the list properly. Fixes #10644 --- src/Encoding.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 9dde12d121..7dc12af027 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -264,11 +264,15 @@ vector Encoding::symbolsList() const vector symbols; for (char_type c = 0; c < start_encodable_; ++c) symbols.push_back(c); - //add all encodable characters + // add all encodable characters copy(encodable_.begin(), encodable_.end(), back_inserter(symbols)); - // now the ones from the unicodesymbols file - for (pair const & elem : unicodesymbols) - symbols.push_back(elem.first); + // now the ones from the unicodesymbols file that are not already there + for (pair const & elem : unicodesymbols) { + if (find(symbols.begin(), symbols.end(), elem.first) == symbols.end()) + symbols.push_back(elem.first); + } + // finally, sort the vector + sort(symbols.begin(), symbols.end()); return symbols; } -- 2.39.5