From f1656faa96d02857bdbd9ef70147a0ba01f0ae51 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 2 Jun 2018 19:23:07 +0200 Subject: [PATCH] Fix TagValue::to{TimeSpan,DateTime}() for UTF-16 --- tagvalue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tagvalue.cpp b/tagvalue.cpp index e9cf2e7..26bafb3 100644 --- a/tagvalue.cpp +++ b/tagvalue.cpp @@ -294,7 +294,7 @@ TimeSpan TagValue::toTimeSpan() const } switch (m_type) { case TagDataType::Text: - return TimeSpan::fromString(string(m_ptr.get(), m_size)); + return TimeSpan::fromString(toString(m_encoding == TagTextEncoding::Utf8 ? TagTextEncoding::Utf8 : TagTextEncoding::Latin1)); case TagDataType::Integer: case TagDataType::TimeSpan: switch (m_size) { @@ -322,7 +322,7 @@ DateTime TagValue::toDateTime() const } switch (m_type) { case TagDataType::Text: - return DateTime::fromString(string(m_ptr.get(), m_size)); + return DateTime::fromString(toString(m_encoding == TagTextEncoding::Utf8 ? TagTextEncoding::Utf8 : TagTextEncoding::Latin1)); case TagDataType::Integer: case TagDataType::DateTime: if (m_size == sizeof(int32)) {