Home
2008:
January
February
March
April
May
June
July
August
2007:
January
February
March
April
May
June
July
August
September
October
November
December
2006:
January
February
March
April
May
June
July
August
September
October
November
December
2005:
January
February
March
April
May
June
July
August
September
October
November
December
2004:
January
February
March
April
May
June
July
August
September
October
November
December
2003:
January
February
March
April
May
June
July
August
September
October
November
December
2002:
January
February
March
April
May
June
July
August
September
October
November
December
2001:
January
February
March
April
May
June
July
August
September
October
November
December
2000:
April
May
June
July
August
September
October
November
December

(keitai-l) Re: emoji and choking waps

From: Craig Dunn <craig.dunn_at_conceptdevelopment.net>
Date: 01/17/01
Message-ID: <OGEGIKAMGPHPOJLMMLMLIEEKCAAA.craig.dunn_at_conceptdevelopment.net>
>>Has anyone built a conversion table?

i don't see much code on this list, but here goes (sorry it's VBScript) --
just outputs the list of emoji IDs and 'names'. If code is not appropriate,
perhaps the moderator(?) can move to list FAQ? unfortunately it's always
more verbose that a few throwaway regexp lines...

this code outputs 'switch' statements for a lookup function. the DO WHILE
loop is easily modified to alter this to any format you like.

i guess it'd more more useful if extracting the kanji for each emoji, but
you'll probably want that data in a specific character set anyway...

cd

p.s. remember \ is 'backslash' :-)
------------------
<%
'/*********************
'* author: Craig Dunn
'* date:   16-Jan-01
'* desc:   extract emoji for a lookup table (EN only so far)
'* assumpt:
'*   expects to find this file
'*   http://www.nttdocomo.com/i/tag/emoji/index.html
'*   with the header and footer HTML removed,
'*   only <tr>..</tr> tags remaining
'*   ie. lots of this:
'            <tr>
'              <td valign="BOTTOM" align="RIGHT"> 9 </td>
'              <td align="CENTER"> <img src="images/9.gif" alt="9"> </td>
'              <td> F8A7 </td>
'              <td> 63655 </td>
'              <td> Aries</td>
'            </tr>
'*********************/
set oFO = Server.CreateObject("Scripting.FilesystemObject")
'/*** MUST CHANGE THIS LINE ***/
set oFile = oFO.OpenTextFile ("C:\TEMP\emoji.txt")
set RegEx = Server.CreateObject("VBScript.RegExp")
sText = oFile.ReadAll
oFile.Close
RegEx.IgnoreCase = TRUE
RegEx.Global = TRUE
RegEx.Pattern = "<td> (63[0-9 ]*)</td>\s*<td>([A-Za-z()\-\&\;0-9e ]*)</td>"
sOut = RegEx.Replace (sText, "<EMOJI><ID>$1</ID><TRA>$2</TRA></EMOJI>" )

if bDebug then Response.Write sOut

iCurPos = 1
do while iCurPos >= 1
	iCurPos = InStr(iCurPos, sOut, "<EMOJI>")
	' FORMAT OF CODE LINE:	case "&#12345;"	: sOut = "[test]"; break;
	Response.write "	case ""&#"
	Response.write Trim(parseTag(iCurPos, "<ID>", "</ID>", sOut))
	Response.write ";""	: sOut = ""["
	Response.write Trim(parseTag(iCurPos, "<TRA>", "</TRA>", sOut))
	Response.write "]""; break;" & vbCRLF

	'/* uncomment to output | seperated list
	'Response.write Trim(parseTag(iCurPos, "<ID>", "</ID>", sOut))
	'Response.write "|"
	'Response.write Trim(parseTag(iCurPos, "<TRA>", "</TRA>", sOut))
	'Response.write vbCRLF
	'*/
	Response.Flush
loop

set RegEx = nothing
set oFile = nothing
set oFO = nothing
Response.end

Function parseTag (iStartPoint, sStart, sEnd, sSource)
	dim iStart, iEnd, sValue
	if iStartPoint >= 1 then
		iStart = InStr(iStartPoint, sSource, sStart)
		if iStart >= 0 then
			iEnd = InStr(iStart, sSource, sEnd)
			if iEnd > 0 then
				sValue = Mid(sSource, iStart + Len(sStart), iEnd - iStart -
Len(sStart))
				iStartPoint = iStartPoint + Len(sValue)
			else
				sValue = ""
			end if
		else
			sValue = ""
		end if
	else
		sValue = ""
	end if
	parseTag = sValue
End Function
%>


[ Did you check the archives?   http://www.appelsiini.net/keitai-l/ ]
Received on Wed Jan 17 03:58:04 2001