Skip to content

Instantly share code, notes, and snippets.

@kontrafiktion
Created February 24, 2012 12:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kontrafiktion/1900750 to your computer and use it in GitHub Desktop.
Save kontrafiktion/1900750 to your computer and use it in GitHub Desktop.
subversion unicode-path patch MacPorts svn 1.7.3
--- subversion/libsvn_subr/path.c 2007-05-01 07:21:03.000000000 +0900
+++ subversion/libsvn_subr/path.c 2007-11-04 23:18:05.000000000 +0900
@@ -31,6 +31,9 @@
#include "svn_io.h" /* for svn_io_stat() */
#include "svn_ctype.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
@@ -1231,6 +1234,36 @@
apr_pool_t *pool)
{
svn_boolean_t path_is_utf8;
+#if defined(DARWIN)
+ svn_error_t *err;
+ /*
+ Compose any decomposed unicode characters precomposed one.
+ This will solve the problem that the 'svn status' command sometime
+ cannot recognize as same file when files suppose to be comtain
+ comopsed characters, like umlaut in some European language or
+ 'Daku-ten' in Japanese, and the files are added on windows machines
+ then you use svn on Mac OS X checking out the files.
+ */
+ CFMutableStringRef cfmsr = CFStringCreateMutable(NULL, 0);
+ CFStringAppendCString(cfmsr, path_apr, kCFStringEncodingUTF8);
+ CFStringNormalize(cfmsr, kCFStringNormalizationFormC);
+ CFIndex path_buff_size = 1 + CFStringGetMaximumSizeForEncoding(
+ CFStringGetLength(cfmsr), kCFStringEncodingUTF8);
+ char *path = apr_palloc(pool, path_buff_size);
+ CFStringGetCString(cfmsr, path, path_buff_size, kCFStringEncodingUTF8);
+
+ SVN_ERR(get_path_encoding(&path_is_utf8, pool));
+
+ if (path_is_utf8)
+ {
+ *path_utf8 = apr_pstrdup(pool, path);
+ err = SVN_NO_ERROR;
+ }
+ else
+ err = svn_utf_cstring_to_utf8(path_utf8, path, pool);
+ CFRelease(cfmsr);
+ return err;
+#else
SVN_ERR(get_path_encoding(&path_is_utf8, pool));
if (path_is_utf8)
{
@@ -1239,6 +1272,7 @@
}
else
return svn_utf_cstring_to_utf8(path_utf8, path_apr, pool);
+#endif
}
svn_error_t *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment