Foreign characters in file names

Thomas Fischer fischer.th at aon.at
Sun Apr 14 07:35:26 EDT 2013


Hello Kenji,

thank you for the hint.
I tried something similar before, and I'm afraid your method doesn't help, and actually seems to confirm what I suspected, that LiveCode as it is (I'm using 6.0.0 now) isn't able to handle foreign characters in file names.
To be more precise: my impression is that LiveCode in principle is able to handle Unicode (with some effort, see http://lessons.runrev.com/m/4067/l/20441), but the actual programming language (what's its current name?) is not.

To explain what I want:
I want the user to choose a folder and then list the folder and its contents, where the names of the files and folders inside might also have foreign characters.

Even if I put the correct name into the field (by copy&paste) and set the field's text font to "Unicode", LiveCode cannot recognise it, it seems that the name is immediately translated into the Mac Font if used in the Script.
And if I try to use it directly like in 
	put (there is a folder fld Ordner1)
then I also get a "false".

If I use AppleScript to get the name, as soon as I do something like
"put the result into tUTF8Text"
the "Ж" in the name of my folder is replaced by a "?" and I found no conversion to bring it back.
And I don't see the files and folders functions handling Unicode.

I actually tried

   put "choose folder" & return into asScript
   put "POSIX path of the result" &return after asScript
   do asScript as appleScript
   put the result into tUTF8Text
   delete char 1 of tUTF8Text
   delete char -1 of tUTF8Text
   set the unicodeText fld Ordner1 to uniencode(tUTF8Text,UTF8)

but never got anything but a ? for the Ж.

Or am I missing a fundamental switch to get this to work?

Best
Thomas

> ------------------------------
> 
> Message: 26
> Date: Sat, 13 Apr 2013 11:41:06 -0400
> From: "index at kenjikojima.com" <index at kenjikojima.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: Foreign characters in file names
> Message-ID: <0F544EEC-A545-458A-8CB3-7D5D2108A2FE at kenjikojima.com>
> Content-Type: text/plain;	charset=utf-8
> 
> Hi Thomas,
> If you are on Mac OS, you can use AppleScript.
> 
> This is for two bytes file name of UTF8 text.
> 
> on mouseUp
>   put "choose file with prompt" &quote&quote&return into asScript
>   put "set openFile to result"&return after asScript
>   put "try"&return after asScript
>   put "read openFile" & return after asScript
>   put "on error"&return after asScript
>   put "close access openFile"&return after asScript
>   put "display dialog "&quote&"Error is occured."&quote&return after asScript
>   put "return"&return after asScript
>   put "end try"&return after asScript
>   do asScript as appleScript
>   put the result into tUTF8Text
>   delete char 1 of tUTF8Text
>   delete char -1 of tUTF8Text
>   set the unicodeText fld 1 to uniencode(tUTF8Text,UTF8)
> end mouseUp
> 
> --
> Kenji Kojima / ????
> http://www.kenjikojima.com/
> 
> 
> On Apr 13, 2013, at 10:19 AM, Thomas Fischer wrote:
> 
>> Hello,
>> 
>> I have a problem with foreign characters in file names, like Cyrillic or Japanese.
>> E.g. I didn't find a way to get the correct name of a folder "Bilder ?" either using "answer folder?" or dragDrop with dragData.
>> Is there a way to handle this situation?
>> 
>> Best regards
>> Thomas Fischer
>> 
>> 
>> 
>> 
>> _______________________________________________
>> 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