You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/07/05 06:00:57 UTC

svn commit: r1499910 - in /subversion/branches/1.8.x: ./ STATUS subversion/bindings/javahl/native/JNIUtil.cpp

Author: svn-role
Date: Fri Jul  5 04:00:57 2013
New Revision: 1499910

URL: http://svn.apache.org/r1499910
Log:
Merge r1492264 from trunk:

 * r1492264
   Fix wrong character encoding handling of generic error messages
   in JavaHL
   Justification:
     Fixes a confusing bug where the generic error message generated by
     JavaHL is mangled due to wrong encoding, but the more specific messages
     generated by the native libraries are legible.
   Votes:
     +1: brane, philip

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/bindings/javahl/native/JNIUtil.cpp

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1492264

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1499910&r1=1499909&r2=1499910&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Fri Jul  5 04:00:57 2013
@@ -246,13 +246,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1492264
-   Fix wrong character encoding handling of generic error messages
-   in JavaHL
-   Justification:
-     Fixes a confusing bug where the generic error message generated by
-     JavaHL is mangled due to wrong encoding, but the more specific messages
-     generated by the native libraries are legible.
-   Votes:
-     +1: brane, philip

Modified: subversion/branches/1.8.x/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1499910&r1=1499909&r2=1499910&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/branches/1.8.x/subversion/bindings/javahl/native/JNIUtil.cpp Fri Jul  5 04:00:57 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)