diff options
| -rw-r--r-- | src/ensembledatabase.cpp | 17 | 
1 files changed, 16 insertions, 1 deletions
| diff --git a/src/ensembledatabase.cpp b/src/ensembledatabase.cpp index 550fdf0..db7154a 100644 --- a/src/ensembledatabase.cpp +++ b/src/ensembledatabase.cpp @@ -82,7 +82,22 @@ std::string label_t::shortlabel() const          }      } -    return shortlabel; +    switch (charset) { +        case charset_e::COMPLETE_EBU_LATIN: +            return convert_ebu_to_utf8(shortlabel); +        case charset_e::UTF8: +            return shortlabel; +        case charset_e::UCS2: +            try { +                return ucs2toutf8((const uint8_t*)shortlabel.data(), shortlabel.size()); +            } +            catch (const range_error&) { +                return ""; +            } +        case charset_e::UNDEFINED: +            throw logic_error("charset undefined"); +    } +    throw logic_error("invalid charset " + to_string((int)charset));  }  string label_t::assemble() const | 
