(keitai-l) Re: emoji and choking waps

From: Craig Dunn <craig.dunn_at_conceptdevelopment.net>
Date: 01/16/01
Message-ID: <OGEGIKAMGPHPOJLMMLMLKEEFCAAA.craig.dunn@conceptdevelopment.net>
>>just regex out anything that matches the pattern: /\&\#\d\d\d\d\d\;/

in ASP - VBScript (for those who haven't used before) [Perl,Javascript,etc.
users try not to laugh]

cd

<%
'/*********************
'* author: Craig Dunn
'* date:   16-Jan-01
'* desc:   filter out 'pesky emoji' : replace with new string
'* assumpt:string contains emoji as 'entity' type chars
'*         of the form &#99999;
'*********************/
Function UnEmoji (ByVal sIn, ByVal sReplaceWith)
	dim sOut	'// Output string
	dim RegEx	'// Regular Expression object
	set RegEx = Server.CreateObject("VBScript.RegExp")
	RegEx.IgnoreCase = TRUE
	RegEx.Global = TRUE
	RegEx.Pattern = "\&\#\d\d\d\d\d\;" ' Thanks ren,
		'i used this, but it's less precise "&\#[0-9]+;"
	sOut = RegEx.Replace (sIn, sReplaceWith)
	set RegEx = nothing
	UnEmoji = sOut
End Function

'/*********************
'* author: Craig Dunn
'* date:   16-Jan-01
'* desc:   filter out 'pesky emoji' : make into IMG tag
'* assumpt:string contains emoji as 'entity' type chars
'*         of the form &#99999;
'*         requires you to have all emoji icons as files
'*         named in the form 99999.gif
'*         may not be a great idea for limited bandwidth, but hey!
'*         could be cool for web-viewing of msgs?
'* disclaim: the emoji icons are (c) NTTDocomo
'*         you should get an artist to create new icons for you
'*         and even that might be suspect!
'*********************/
Function emojiToGIF (sIn)
	dim sOut
	dim RegEx
	set RegEx = Server.CreateObject("VBScript.RegExp")
	RegEx.IgnoreCase = TRUE
	RegEx.Global = TRUE
	RegEx.Pattern = "\&\#(\d\d\d\d\d)\;"
	sOut = RegEx.Replace (sIn, "<img src='/img/$1.gif'>" )
	set RegEx = nothing
	emojiToGIF = sOut
End Function
%>


[ Did you check the archives?   http://www.appelsiini.net/keitai-l/ ]
Received on Tue Jan 16 05:17:26 2001