Unicode in file paths...

Mark Schonewille m.schonewille at economy-x-talk.com
Thu May 7 03:17:13 EDT 2015


Hi Paul,

Before playing a movie, you could use AppleScript or shell to store a 
copy of the file in the temp folder with a name encoded in 
MacRoman-compatible characters. (Use UTF8 for the file path in 
AppleScript). You may need to save the AppleScript as a .scpt file on 
disk and execute with the AppleScript command

run script <filepath> as alias

The UTF8 encoded script in <filepath> would be

tell application "Finder"
   set tempFolder to path top temporary items as alias
   set newFile to duplicate alias "original filepath" to tempFolder
   set name of newFile to "MacRoman compatible.mov"
end tell

This allows you to execute a MacRoman encoded command in LiveCode to run 
a UTF8 encoded AppleScript on disk. Now you can set the filename of a 
player to a MacRoman encoded file path.

Let me know if it works (or doesn't).

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/7/2015 01:08, Paul Dupuis wrote:
> I am trying to simply prompt for a movie file and set the filename of a
> player to that filespec. Essentially:
>
> answer file "Pick a movie:"
> set the fileName of player 1 to shortFilePath(it)
>
> If I have a movie file, say video.mov in a folder with Unicode
> characters, say "Κάποια έρευνα" (Greek), the answer file command in
> LC6.7.4 returns a string (i.e. C:/Users/Paul/Desktop/HR400-LC674/Media
> Testing/??p??a ??e??a/video.mp4) that is not recognized by the player
> object for accessing that file. The same movie file is recognized on OSX
> or Win if it is in a file path with no Unicode characters in it.
>
> Under LC 7.0.4, answer file returns a legible filespec (i.e.
> C:/Users/Paul/Desktop/HR400-LC674/Media Testing/Κάποια
> έρευνα/video.mp4), and the player recognizes the movie under Windows
> (using Quicktime - this is because of the use of the shortFilePath
> function, without shortFilePath, QT does not recognize a filespec with
> Unicode in it) and under OSX 10.8+ using the AVFoundation. However, it
> fails under OSX 10.7 and 10.6 (using QT instead of AVF)
>
> Given that every OS today support robust folder and file names, my
> question is: Is there any work around for this in LC6.7.4 (or 6.7.5)?
>
> I can not migrate to LC7 just now - we have too much code tied to the
> old way Unicode works that need to be updated and perhaps a zillion
> places where 'char' is used on binary data that need to be updated to
> byte. However, if I could go to LC7, it appear that you still can not
> play movies with Unicode in the file path under OSX10.6 or 10.7 (i.e QT
> under OSX) or is there a workaround for that?
>
> If there is anyone who has cracked this nut, help would be much appreciated.





More information about the use-livecode mailing list