Non-Ascii Chars in Filenames

Martin Baxter mblivecode at
Thu Jan 9 19:53:59 EST 2014

On 09/01/14 23:43, Ender Nafi Elekcioglu wrote:
> Hi,  
> Is there any way to deal with files whose filenames contain non-ascii chars?  
> Assume that *tFilename* is *specialFolderPath(“desktop”) & “/ağaç.png”*
> _set the filename of image 1 to tFilename  
> results with an empty image.
> _set the filename of image 1 to URLEncode(tFilename)  
> same, an empty image.
> I even tried this:
> _set the filename of image 1 to uniEncode(tFilename, “utf8”)
> I know it’s kinda stupid but it was a desperate attempt.  
> The thing is I can’t control the filenames.  
> There are thousands of images in the server
> and different people {editors} upload them.
> Some of those so-called computer literate editors insist to name the files with non-ascii chars.
> Since the underlying OS or the server doesn’t complain
> {see, utf8 became a common standard for years if not decades}.
> they don’t notice the error and I end up with the headache.
> So, is there any workaround to make Livecode accept those files?  
> Thanks for all your help...  
> Best,  
> ~ Ender 

Hopefully someone has a better way than this, but I have just opened a
file that I had named ağaç.txt

I scripted answer file, selected the file and then used the returned
file path string directly to open the file.

Answer file seemingly returns the single byte string of which the path
actually consists, and while you would get nonsense if you displayed
that unmodified, it seems to work here to open the file.

You can maybe see what it returns:

answer file "select a file"
put it

If that works for you, you might be able to store that string somewhere
invisible for future reuse, you would just need to acquire it initially
through the answer file command or the files.

I think this is called cheating, and may not work in all cases/on all
platforms/your situation, perhaps.

I'm using Linux.


More information about the Use-livecode mailing list