[TextMate] htmlentitizing text
Allan Odgaard
allan at macromates.com
Sat Oct 23 22:57:25 UTC 2004
On 23. Oct 2004, at 23:13, Nis Sarup wrote:
> But, alas, as in the terminal æøå gets mangled into
> \303\246\303\270\303\245 before being entitized.
> <, &, ", ' and other "normal" special chars gets converted just fine.
> Is there a workaround for the brutal mangling of the innocent danish
> characters?
TextMate "exports" all text as utf-8. So æ, ø, and å would be "mangled"
as such (I've been wanting to put that in the manual! ;) ).
If you only work with latin-1 characters, you could make the command
like this (two lines):
TM_LATIN_1=`echo $TM_SELECTED_TEXT | iconv -f utf-8 -t iso-8859-1`
php -r "echo htmlentities('$TM_LATIN_1', ENT_QUOTES);"
For me that turns: Æblegrød og rød grød med fløde er godt!
Into: Æblegrød og rød grød med fløde
er godt!
There's also a php version of iconv, but I do not think it's in the
version shipped by Apple.
Kind regards Allan
More information about the textmate
mailing list