Skip to content

Instantly share code, notes, and snippets.

@tholu
Created July 2, 2013 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tholu/5913878 to your computer and use it in GitHub Desktop.
Save tholu/5913878 to your computer and use it in GitHub Desktop.
utf8_patch_clemensmg.diff
--- subversion/libsvn_subr/path.c 2013-05-14 00:40:07.000000000 +0200
+++ subversion/libsvn_subr/path.c 2013-07-02 23:39:04.000000000 +0200
@@ -40,6 +40,10 @@
#include "dirent_uri.h"
+#ifdef DARWIN
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
/* 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 +1104,6 @@ svn_path_get_absolute(const char **pabso
}
-#if !defined(WIN32) && !defined(DARWIN)
/** Get APR's internal path encoding. */
static svn_error_t *
get_path_encoding(svn_boolean_t *path_is_utf8, apr_pool_t *pool)
@@ -1119,7 +1122,6 @@ get_path_encoding(svn_boolean_t *path_is
*path_is_utf8 = (encoding_style == APR_FILEPATH_ENCODING_UTF8);
return SVN_NO_ERROR;
}
-#endif
svn_error_t *
@@ -1127,19 +1129,15 @@ svn_path_cstring_from_utf8(const char **
const char *path_utf8,
apr_pool_t *pool)
{
-#if !defined(WIN32) && !defined(DARWIN)
svn_boolean_t path_is_utf8;
SVN_ERR(get_path_encoding(&path_is_utf8, pool));
if (path_is_utf8)
-#endif
{
*path_apr = apr_pstrdup(pool, path_utf8);
return SVN_NO_ERROR;
}
-#if !defined(WIN32) && !defined(DARWIN)
else
return svn_utf_cstring_from_utf8(path_apr, path_utf8, pool);
-#endif
}
@@ -1148,16 +1146,24 @@ svn_path_cstring_to_utf8(const char **pa
const char *path_apr,
apr_pool_t *pool)
{
-#if !defined(WIN32) && !defined(DARWIN)
+#ifdef DARWIN
+ 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
svn_boolean_t path_is_utf8;
SVN_ERR(get_path_encoding(&path_is_utf8, pool));
if (path_is_utf8)
-#endif
{
*path_utf8 = apr_pstrdup(pool, path_apr);
return SVN_NO_ERROR;
}
-#if !defined(WIN32) && !defined(DARWIN)
else
return svn_utf_cstring_to_utf8(path_utf8, path_apr, pool);
#endif
--- subversion/svn/proplist-cmd.c 2013-02-24 19:31:38.000000000 +0100
+++ subversion/svn/proplist-cmd.c 2013-07-02 23:39:54.000000000 +0200
@@ -98,6 +98,11 @@ proplist_receiver_xml(void *baton,
else
name_local = path;
+#ifdef DARWIN
+ if(! is_url)
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool));
+#endif
+
sb = NULL;
@@ -137,6 +142,11 @@ proplist_receiver(void *baton,
else
name_local = path;
+#ifdef DARWIN
+ if (! is_url)
+ SVN_ERR(svn_path_cstring_to_utf8(&name_local, name_local, pool));
+#endif
+
if (inherited_props)
{
int i;
--- subversion/svn/status-cmd.c 2013-03-23 16:44:36.000000000 +0100
+++ subversion/svn/status-cmd.c 2013-07-02 23:39:54.000000000 +0200
@@ -111,6 +111,10 @@ print_start_target_xml(const char *targe
{
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool);
+#ifdef 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