Using ASP to realize simple simplified conversion
Internationalization seems to be a very popular slogan, a website does not have the English version at least to get a traditional version, after all, are Chinese characters, translation will not be so troublesome: P
The general simplified conversion is to use a dictionary, through the GB of the internal code to calculate the position of the BIG5 character in the dictionary, read the display, with the FSO should be able to achieve. The method introduced here is more simple, with Dictionary object, is the dictionary, hehe, DICGB2BIG5 (GB) is the corresponding BIG5. It is easier to read the characters by location than in the calculation code:)
To reduce overhead, place the dictionary in application, which is to create two application dictionary objects in the Global.asa
<object id=objgb2big5 progid= "scripting.dictionrary" runat= "Server" scope= "Application" >
</OBJECT>
<object id=objbig52gb progid= "scripting.dictionrary" runat= "Server" scope= "Application" >
</OBJECT>
Add items to a dictionary in Application_OnStart
......
Objgb2big5.add "Ah", "pendulum"
Objgb2big5.add "Ah", ""
Objgb2big5.add "Aye", "bottle"
......
......
Objbig52gb.add "Pendulum", "Ah"
Objbig52gb.add "", "Ah"
Objbig52gb.add "Bottle", "Aye"
......
A lot of dictionaries, not all of them.
Do a dictionary, use the time as long as a check on the line:)
function Gb2big5 (str)
Dim i, L, K, T, RTN
L = Len (str)
Rtn= ""
For I=1 to L
K = Mid (str, I, 1)
If AscW (k) >=0 and AscW (k) <128 Then
t = k
Else
If Objgb2big5.exists (k) Then
T = Objgb2big5.item (k)
Else
t = ""
End If
End If
RTN = RTN & T
Next
Gb2big5 = Rtn
End Function
function BIG52GB (str)
Dim i, L, K, T, RTN
L = Len (str)
Rtn= ""
For I=1 to L
K = Mid (str, I, 1)
If AscW (k) >=0 and AscW (k) <128 Then
t = k
Else
If Objbig52gb.exists (k) Then
T = Objbig52gb.item (k)
Else
t = ""
End If
End If
RTN = RTN & T
Next
BIG52GB = Rtn
End Function
Let's test it out.