From 0a9e68b2895fb53164ac55be844d365018ec0444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 14 Mar 2019 07:09:45 +0100 Subject: [PATCH] Don't send an empty codec field in case of default ISO-8859-1, remove the related warning --- src/engine/sidechain/shoutconnection.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp index 9c272c69128..dd2ab9ca2b0 100644 --- a/src/engine/sidechain/shoutconnection.cpp +++ b/src/engine/sidechain/shoutconnection.cpp @@ -186,17 +186,19 @@ void ShoutConnection::updateFromPreferences() { // strings to pass to libshout. QString codec = m_pProfile->getMetadataCharset(); - QByteArray baCodec = codec.toLatin1(); - m_pTextCodec = QTextCodec::codecForName(baCodec); - if (!m_pTextCodec) { - kLogger.warning() - << "Couldn't find broadcast metadata codec for codec:" << codec - << " defaulting to ISO-8859-1."; + if (!codec.isEmpty()) { + QByteArray baCodec = codec.toLatin1(); + m_pTextCodec = QTextCodec::codecForName(baCodec); + if (!m_pTextCodec) { + kLogger.warning() + << "Couldn't find broadcast metadata codec for codec:" << codec + << " defaulting to ISO-8859-1."; + } else { + // Indicates our metadata is in the provided charset. + insertMetaData("charset", baCodec.constData()); + } } - // Indicates our metadata is in the provided charset. - shout_metadata_add(m_pShoutMetaData, "charset", baCodec.constData()); - QString serverType = m_pProfile->getServertype(); QString host = m_pProfile->getHost();