Non-Ascii Chars in Filenames
John Dixon
dixonja at hotmail.co.uk
Thu Jan 9 20:00:52 EST 2014
Hi Ender...
Just did the same as Martin, but with an image file named : épøtç†.png
on mouseUp
answer file ""
if it is not empty then
set the filename of image 1 to it
put the filename of image 1 into fld 1
end if
end mouseUp
filepath returned in fld 1 : /Users/johndixon/Desktop/épøtç†.png
> Date: Fri, 10 Jan 2014 00:53:59 +0000
> From: mblivecode at harbourhosting.co.uk
> To: use-livecode at lists.runrev.com
> Subject: Re: Non-Ascii Chars in Filenames
>
> 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.
>
> Martin
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list