Created
February 18, 2016 10:54
-
-
Save tholu/fb5d30c586e33b53ecba to your computer and use it in GitHub Desktop.
Unicode patch for subversion18 for homebrew tap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: subversion/libsvn_subr/io.c | |
=================================================================== | |
--- subversion/libsvn_subr/io.c (revision 1527683) | |
+++ subversion/libsvn_subr/io.c (working copy) | |
@@ -154,7 +154,7 @@ | |
const char *path_apr, | |
apr_pool_t *pool) | |
{ | |
-#if defined(WIN32) || defined(DARWIN) | |
+#if defined(WIN32) | |
*path_utf8 = path_apr; | |
return SVN_NO_ERROR; | |
#else | |
@@ -237,7 +237,7 @@ | |
const char *parent, | |
apr_pool_t *pool) | |
{ | |
-#if defined(WIN32) || defined(DARWIN) | |
+#if defined(WIN32) | |
*name_p = apr_pstrdup(pool, name); | |
return SVN_NO_ERROR; | |
#else | |
Index: subversion/libsvn_subr/path.c | |
=================================================================== | |
--- subversion/libsvn_subr/path.c (revision 1527683) | |
+++ subversion/libsvn_subr/path.c (working copy) | |
@@ -40,6 +40,9 @@ | |
#include "dirent_uri.h" | |
+#if defined(DARWIN) | |
+#include <CoreFoundation/CoreFoundation.h> | |
+#endif /* DARWIN */ | |
/* The canonical empty path. Can this be changed? Well, change the empty | |
test below and the path library will work, not so sure about the fs/wc | |
@@ -1100,7 +1103,7 @@ | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+#if !defined(WIN32) | |
/** Get APR's internal path encoding. */ | |
static svn_error_t * | |
get_path_encoding(svn_boolean_t *path_is_utf8, apr_pool_t *pool) | |
@@ -1127,7 +1130,7 @@ | |
const char *path_utf8, | |
apr_pool_t *pool) | |
{ | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+#if !defined(WIN32) | |
svn_boolean_t path_is_utf8; | |
SVN_ERR(get_path_encoding(&path_is_utf8, pool)); | |
if (path_is_utf8) | |
@@ -1136,7 +1139,7 @@ | |
*path_apr = apr_pstrdup(pool, path_utf8); | |
return SVN_NO_ERROR; | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+#if !defined(WIN32) | |
else | |
return svn_utf_cstring_from_utf8(path_apr, path_utf8, pool); | |
#endif | |
@@ -1148,18 +1151,38 @@ | |
const char *path_apr, | |
apr_pool_t *pool) | |
{ | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+#if defined(DARWIN) | |
+ /* | |
+ Special treatment for Mac OS X to support UTF-8 MAC encodings. | |
+ Convert any decomposed unicode characters into precomposed ones. | |
+ This will solve the problem that the 'svn status' command sometimes | |
+ cannot recognize the same file if it contains composed characters, | |
+ like Umlaut in some European languages. | |
+ */ | |
+ CFMutableStringRef cfmsr = CFStringCreateMutable(NULL, 0); | |
+ CFStringAppendCString(cfmsr, path_apr, kCFStringEncodingUTF8); | |
+ CFStringNormalize(cfmsr, kCFStringNormalizationFormC); | |
+ CFIndex path_buff_size = 1 + CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfmsr), kCFStringEncodingUTF8); | |
+ path_apr = apr_palloc(pool, path_buff_size); | |
+ CFStringGetCString(cfmsr, path_apr, path_buff_size, kCFStringEncodingUTF8); | |
+ CFRelease(cfmsr); | |
+ *path_utf8 = path_apr; | |
+ return SVN_NO_ERROR; | |
+#else | |
+ /* Use the default method on any other OS */ | |
+ #if !defined(WIN32) | |
svn_boolean_t path_is_utf8; | |
SVN_ERR(get_path_encoding(&path_is_utf8, pool)); | |
if (path_is_utf8) | |
-#endif | |
+ #endif | |
{ | |
*path_utf8 = apr_pstrdup(pool, path_apr); | |
return SVN_NO_ERROR; | |
} | |
-#if !defined(WIN32) && !defined(DARWIN) | |
+ #if !defined(WIN32) | |
else | |
return svn_utf_cstring_to_utf8(path_utf8, path_apr, pool); | |
+ #endif | |
#endif | |
} | |
Index: subversion/svn/proplist-cmd.c | |
=================================================================== | |
--- subversion/svn/proplist-cmd.c (revision 1527683) | |
+++ subversion/svn/proplist-cmd.c (working copy) | |
@@ -98,6 +98,11 @@ | |
else | |
name_local = path; | |
+#if defined(DARWIN) | |
+ if (! is_url) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool)); | |
+#endif | |
+ | |
sb = NULL; | |
@@ -137,6 +142,11 @@ | |
else | |
name_local = path; | |
+#if defined(DARWIN) | |
+ if (! is_url) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool)); | |
+#endif | |
+ | |
if (inherited_props) | |
{ | |
int i; | |
Index: subversion/svn/status-cmd.c | |
=================================================================== | |
--- subversion/svn/status-cmd.c (revision 1527683) | |
+++ subversion/svn/status-cmd.c (working copy) | |
@@ -114,6 +114,10 @@ | |
{ | |
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool); | |
+#if defined(DARWIN) | |
+ SVN_ERR(svn_path_cstring_to_utf8(&target, target, pool)); | |
+#endif | |
+ | |
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "target", | |
"path", target, NULL); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment