[TxMt] tm_dialog: *.plist | pl -> utf8 SOLUTION

Hans-Joerg Bibiko bibiko at eva.mpg.de
Fri Nov 17 15:25:05 UTC 2006


Here comes my solution:

I wrote two BASH scripts 'plutf8' and 'defaultsread'.


#######
plutf8 MyPlist

will convert a XML property list in 'old-styled' plist encoded in utf8.
(Hint: MyPlist without .plist extension!!)

example:
   C=$( plutf8 "$TM_BUNDLE_SUPPORT"/bin/HSDOut )


You also can pipe data to plutf8:
example:
   DIA=$( cat "$TM_BUNDLE_SUPPORT"/bin/HSDOut.plist | tm_dialog -m  
hypersearch | plutf8 )



########
defaultsread <domain> <key>

reads the <key> from <domain> and converts it to utf8.
(Hint: <domain> without .plist extension!!)

example:
   B=$( defaultsread "$TM_BUNDLE_SUPPORT"/bin/HSDOut searchString )


############

Both scripts also converts UTF-16 surrogates. So you can use it for  
Unicode characters which are specified above 0xFFFF.
(Because I'm dealing with such characters a lot ;) )

So, if you are expecting such characters you can use these scripts  
instead of 'pl' and 'defaults read' and you will get what did you enter.


I put these scripts into $TM_SUPPORT_PATH/bin so there is no need to  
write the path.

Maybe these scripts are worth to put into the TM release (?)

Comments??


All the best,

Hans

-------------- next part --------------
A non-text attachment was scrubbed...
Name: defaultsread
Type: application/octet-stream
Size: 1442 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061117/d0b6cfcc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plutf8
Type: application/octet-stream
Size: 3001 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20061117/d0b6cfcc/attachment-0001.obj>
-------------- next part --------------



More information about the textmate mailing list