diff --git a/src/convert.cpp b/src/convert.cpp
index 135fd0a9..ce3e8fe3 100644
--- a/src/convert.cpp
+++ b/src/convert.cpp
@@ -71,8 +71,8 @@ EXIV2_RCSID("@(#) $Id$")
// local declarations
namespace {
#if defined WIN32 && !defined __CYGWIN__
- // Convert string charset with Windows MSVC functions.
- bool convertStringCharsetMsvc(std::string& str, const char* from, const char* to);
+ // Convert string charset with Windows functions.
+ bool convertStringCharsetWindows(std::string& str, const char* from, const char* to);
#endif
#if defined EXV_HAVE_ICONV
// Convert string charset with iconv.
@@ -1335,7 +1335,7 @@ namespace Exiv2 {
#if defined EXV_HAVE_ICONV
ret = convertStringCharsetIconv(str, from, to);
#elif defined WIN32 && !defined __CYGWIN__
- ret = convertStringCharsetMsvc(str, from, to);
+ ret = convertStringCharsetWindows(str, from, to);
#else
# ifndef SUPPRESS_WARNINGS
EXV_WARNING << "Charset conversion required but no character mapping functionality available.\n";
@@ -1490,16 +1490,18 @@ namespace {
// Update the convertStringCharset() documentation if you add more here!
};
- bool convertStringCharsetMsvc(std::string& str, const char* from, const char* to)
+ bool convertStringCharsetWindows(std::string& str, const char* from, const char* to)
{
bool ret = false;
const ConvFctList* p = find(convFctList, std::make_pair(from, to));
- if (p) ret = p->convFct_(str);
+ std::string tmpstr = str;
+ if (p) ret = p->convFct_(tmpstr);
#ifndef SUPPRESS_WARNINGS
else {
EXV_WARNING << "No Windows function to map character string from " << from << " to " << to << " available.\n";
}
#endif
+ if (ret) str = tmpstr;
return ret;
}
diff --git a/src/convert.hpp b/src/convert.hpp
index 545723b8..d56709a3 100644
--- a/src/convert.hpp
+++ b/src/convert.hpp
@@ -81,29 +81,32 @@ namespace Exiv2 {
/*!
@brief Convert character encoding of \em str from \em from to \em to.
- The string is modified and its size may change.
-
- This function uses the iconv library, if Exiv2 was compiled with iconv
- support. Otherwise, on Windows, it uses MSVC functions to support a
- limited number of conversions and issues a warning if an unsupported
- conversion is attempted. The conversions supported on Windows without
- iconv are:
-
- from: UTF-8 to: UCS-2BE
- from: UTF-8 to: UCS-2LE
- from: UCS-2BE to: UTF-8
- from: UCS-2BE to: UCS-2LE
- from: UCS-2LE to: UTF-8
- from: UCS-2LE to: UCS-2BE
- from: ISO-8859-1 to: UTF-8
- from: ASCII to: UTF-8
-
- If the function is called but Exiv2 was not compiled with iconv support
- and can't use Windows MSVC functions, it issues a warning.
+ If the function succeeds, \em str contains the result string.
+
+ This function uses the iconv library, if the %Exiv2 library was compiled
+ with iconv support. Otherwise, on Windows, it uses Windows functions to
+ support a limited number of conversions and fails with a warning if an
+ unsupported conversion is attempted. If the function is called but %Exiv2
+ was not compiled with iconv support and can't use Windows functions, it
+ fails with a warning.
+
+ The conversions supported on Windows without iconv are:
+
+
from | to |
UTF-8 | UCS-2BE |
UTF-8 | UCS-2LE |
UCS-2BE | UTF-8 |
UCS-2BE | UCS-2LE |
UCS-2LE | UTF-8 |
UCS-2LE | UCS-2BE |
ISO-8859-1 | UTF-8 |
ASCII | UTF-8 |