Index: aem/macosx/aem.c ================================================================== --- aem/macosx/aem.c +++ aem/macosx/aem.c @@ -92,20 +92,18 @@ AEDisposeDesc(&directParameter); /*Need to convert paramstring to something Tcl can handle gracefully. Direct conversion of AE params to char does not seem to work well, produces garbage.*/ CFStringRef arg = CFStringCreateWithBytes(0, paramstring, sizeof(paramstring), kCFStringEncodingUTF8, false); - - // as_arg = CFStringGetCStringPtr(arg, kCFStringEncodingUTF8); - CFIndex stringLengthIndex = CFStringGetLength(arg); - CFStringGetCString(arg, as_arg, stringLengthIndex, kCFStringEncodingUTF8); - - fprintf(stdout, "the arg is %s\n", as_arg); + CFDataRef data; + data = CFStringCreateExternalRepresentation(NULL, arg, kCFStringEncodingUTF8, 0); + if (data) { + as_arg = (const char *)CFDataGetBytePtr(data); + } CFRelease(arg); } else { as_arg = " "; - fprintf(stdout, "the null arg is %s\n", as_arg); } /* Get command keyed to eventID from dict and pass to Tcl for execution. */ CFTypeRef scriptName; stringeventID = UTCreateStringForOSType(eventID); @@ -130,11 +128,11 @@ /* Build the command to eval. */ Tcl_DStringAppend(&as_cmd, applescript_tcl_cmd, -1); Tcl_DStringAppend(&as_cmd, " ", -1); - /* Tcl_DStringAppend(&as_cmd, as_arg, -1); */ + Tcl_DStringAppend(&as_cmd, as_arg, -1); /* Eval the Tcl command. */ Tcl_Eval(AS_Interp, Tcl_DStringValue(&as_cmd)); Tcl_DStringFree(&as_cmd);