HTML encoder

By Ayon on Jul 16, 2009

Well as the title sais, this is a html encoder. I know it's not 100% correct atm, but it's a start.

Usage:
$htmlencode(html goes here)

alias htmlencode {
  var %str = $replace($1-,&,&,<,<,>,>)
  var %str = $regsubex(%str,/&#(\d+?);/g,$chr(\1))
  var %str = $regsubex(%str,/&#x([\dA-F][\dA-F]);/g,$chr($base(\1,16,10)))
  return %str
}

Comments

Sign in to comment.
Solitude   -  Jul 16, 2009

Blargh. I don't really understand Regular Expressions, lol. Not how mIRC uses them, anyways..

 Respond  
Noutrious   -  Jul 16, 2009

alias htmlencode return $regsubex($regsubex($replace($1-,&,&,<,<,>,>),/&#(\d+?);/g,$chr(\1)),/&#x([\dA-F][\dA-F]);/g,$chr($base(\1,16,10)))

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.