Mercurial > hg > orthanc
diff Core/Toolbox.cpp @ 953:f894be6e7cc1 query-retrieve
merge mainline -> query-retrieve
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 Jun 2014 15:34:40 +0200 |
parents | 8811abd6aec9 |
children | 98d6ba37c7dc 743a75b14bef 2fd5a163776d |
line wrap: on
line diff
--- a/Core/Toolbox.cpp Wed Jun 25 12:09:38 2014 +0200 +++ b/Core/Toolbox.cpp Wed Jun 25 15:34:40 2014 +0200 @@ -66,8 +66,8 @@ #include <boost/locale.hpp> -#include "../Resources/md5/md5.h" -#include "../Resources/base64/base64.h" +#include "../Resources/ThirdParty/md5/md5.h" +#include "../Resources/ThirdParty/base64/base64.h" #ifdef _MSC_VER @@ -495,11 +495,27 @@ std::string Toolbox::ConvertToUtf8(const std::string& source, - const char* fromEncoding) + const Encoding sourceEncoding) { + const char* encoding; + + switch (sourceEncoding) + { + case Encoding_Utf8: + // Already in UTF-8: No conversion is required + return source; + + case Encoding_Latin1: + encoding = "ISO-8859-1"; + break; + + default: + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + try { - return boost::locale::conv::to_utf<char>(source, fromEncoding); + return boost::locale::conv::to_utf<char>(source, encoding); } catch (std::runtime_error&) {