diff --git a/adb/get_my_path_darwin.c b/adb/get_my_path_darwin.c
index 65dd2263c94348127f17ad1bb7bc3588f0132578..ff1396c31815aa4f41e6972c3750a41777540a3e 100644
--- a/adb/get_my_path_darwin.c
+++ b/adb/get_my_path_darwin.c
@@ -24,7 +24,7 @@ void get_my_path(char *s, size_t maxLen)
     CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
     CFRelease(executableURL);
 
-    CFStringGetCString(executablePathString, s, maxLen, kCFStringEncodingASCII);
+    CFStringGetFileSystemRepresentation(executablePathString, s, maxLen);
     CFRelease(executablePathString);
 }
 
diff --git a/fastboot/util_osx.c b/fastboot/util_osx.c
index a8f5c315865bf28c93cecf69ba2f7a9087ecc922..e7185627337c903379cdd346019ca3c61b42f1ba 100644
--- a/fastboot/util_osx.c
+++ b/fastboot/util_osx.c
@@ -36,7 +36,7 @@ void get_my_path(char s[PATH_MAX])
     CFStringRef executablePathString = CFURLCopyFileSystemPath(executableURL, kCFURLPOSIXPathStyle);
     CFRelease(executableURL);
 
-    CFStringGetCString(executablePathString, s, PATH_MAX-1, kCFStringEncodingASCII);
+    CFStringGetFileSystemRepresentation(executablePathString, s, PATH_MAX-1);
     CFRelease(executablePathString);
 
 	char *x;