subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1492264 - /subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
Date Wed, 12 Jun 2013 16:25:39 GMT
Author: brane
Date: Wed Jun 12 16:25:39 2013
New Revision: 1492264

URL: http://svn.apache.org/r1492264
Log:
JavaHL should not mess up non-Ascii system error messages.

* subversion/bindings/javahl/native/JNIUtil.cpp (JNIUtil::assembleErrorMessage):
   Convert generic error messages from apr_strerror to UTF-8 before
   appending them to the message list.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1492264&r1=1492263&r2=1492264&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Wed Jun 12 16:25:39 2013
@@ -871,7 +871,21 @@ void JNIUtil::assembleErrorMessage(svn_e
         buffer.append(svn_strerror(err->apr_err, errbuf, sizeof(errbuf)));
       /* Otherwise, this must be an APR error code. */
       else
-        buffer.append(apr_strerror(err->apr_err, errbuf, sizeof(errbuf)));
+        {
+          /* Messages coming from apr_strerror are in the native
+             encoding, it's a good idea to convert them to UTF-8. */
+          const char* utf8_message;
+          apr_strerror(err->apr_err, errbuf, sizeof(errbuf));
+          svn_error_t* utf8_err = svn_utf_cstring_to_utf8(
+              &utf8_message, errbuf, err->pool);
+          if (utf8_err)
+            {
+              /* Use fuzzy transliteration instead. */
+              svn_error_clear(utf8_err);
+              utf8_message = svn_utf_cstring_from_utf8_fuzzy(errbuf, err->pool);
+            }
+          buffer.append(utf8_message);
+        }
       buffer.append("\n");
     }
   if (err->message)



Mime
View raw message