SHELL text encoding OS X?

Klaus major-k klaus at major-k.de
Sat Jul 26 11:22:56 EDT 2014


Hi Peter,

Am 26.07.2014 um 16:32 schrieb Peter W A Wood <peterwawood at gmail.com>:

> Hi Klaus
> 
> As I understand, the OS X shell assumes text is UTF-8 encoded whereas Livecode on OS X assumes text is MacRoman encoded. (I'm guessing you're running this on a Mac).
> 
> So you need to convert the UTF-8 to MacRoman. With LiveCode 6.6, I believe that involves converting first to "unicode" (actually UTF-16) and then to MacRoman. I took a quick look at Devin Asay's Unicode tutorial - http://livecode.byu.edu/unicode/unicodeInRev.php
> 
> It seems you need to do something like this, assuming you have a "spare" field hanging around:
> 	set the unicodetext of field "temp" to uniencode(tResultFromMDFind,"UTF8")
> 	get the unicodetext of field "temp"
> 	put unidecode(it,"English") into tWhatIWanted

YES! Thanks a lot! 

I (mis-)used the templatefield and works fine, too :-)
...
put shell("mdfind" && tFind) into tFiles
set the unicodetext of the templatefield to uniencode(tFiles,"UTF8")
put the unicodetext of the templatefield into tUTF
put unidecode(tUTF,"English") into tFiles2
reset the templatefield

Et voila, Umlauts, thanks again!


But the new LC 7 way will be of course much slicker:
...
put textDecode(shell("mdfind" && tFind),"utf-8") into tFiles
...
8-)

> I realise that the English seems a bit odd for German but I think it's a LiveCode synonym for what Unicode calls "Roman" languages.
> 
> Hope this helps.

It does!

> Regards
> 
> Peter

Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list