-
Notifications
You must be signed in to change notification settings - Fork 0
/
Class1.vb
207 lines (181 loc) · 7.46 KB
/
Class1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
Imports System.Text
Public Class Class1
Public Shared Sub Main
Dim htmlEncoding as String = "Hello&sp;World!"
Dim asciiEncoding as String = ConvertHtmlCharactersToAsciiCharacters(htmlEncoding)
Console.Write(asciiEncoding)
End Sub
Private Shared Function ConvertHtmlCharactersToAsciiCharacters(s As String) As String
Dim sb As New StringBuilder(s)
sb.Replace(vbCrLf, "")
sb.Replace("­", "")
sb.Replace("&sp;", ChrW(32))
sb.Replace("!", ChrW(33))
sb.Replace(""", ChrW(34))
sb.Replace("#", ChrW(35))
sb.Replace("$", ChrW(36))
sb.Replace("&percent;", ChrW(37))
sb.Replace("&", ChrW(38))
sb.Replace("'", ChrW(39))
sb.Replace("(", ChrW(40))
sb.Replace(")", ChrW(41))
sb.Replace("*", ChrW(42))
sb.Replace("+", ChrW(43))
sb.Replace(",", ChrW(44))
sb.Replace("−", ChrW(45))
sb.Replace("‐", ChrW(45))
sb.Replace(".", ChrW(46))
sb.Replace("⁄", ChrW(47))
sb.Replace("/", ChrW(47))
'Chrw(48-57) lowercase alphanumberic
sb.Replace(":", ChrW(58))
sb.Replace(";", ChrW(59))
sb.Replace("<", ChrW(60))
sb.Replace("=", ChrW(61))
sb.Replace(">", ChrW(62))
sb.Replace("?", ChrW(63))
sb.Replace("@", ChrW(64))
'Chrw(65-90) lowercase alphanumberic
sb.Replace("[", ChrW(91))
sb.Replace("[", ChrW(91))
sb.Replace("\", ChrW(92))
sb.Replace("]", ChrW(93))
sb.Replace("]", ChrW(93))
sb.Replace("^", ChrW(94))
sb.Replace("ˆ", ChrW(94))
sb.Replace("_", ChrW(95))
sb.Replace("―", ChrW(95))
sb.Replace("`", ChrW(96))
'Chrw(97-122) lowercase alphanumberic
sb.Replace("{", ChrW(123))
sb.Replace("{", ChrW(123))
sb.Replace("|", ChrW(124))
sb.Replace("|", ChrW(124))
sb.Replace("}", ChrW(125))
sb.Replace("}", ChrW(125))
sb.Replace("˜", ChrW(126))
'Chrw(127) Delete, No equiv in html
sb.Replace("Ç", ChrW(128))
sb.Replace("û", ChrW(129))
sb.Replace("é", ChrW(130))
sb.Replace("â", ChrW(131))
sb.Replace("ä", ChrW(132))
sb.Replace("à", ChrW(133))
sb.Replace("å", ChrW(134))
sb.Replace("ç", ChrW(135))
sb.Replace("ê", ChrW(136))
sb.Replace("ë", ChrW(137))
sb.Replace("è", ChrW(138))
sb.Replace("ï", ChrW(139))
sb.Replace("î", ChrW(140))
sb.Replace("ì", ChrW(141))
sb.Replace("Ä", ChrW(142))
sb.Replace("Å", ChrW(143))
sb.Replace("É", ChrW(144))
sb.Replace("æ", ChrW(145))
sb.Replace("Æ", ChrW(146))
sb.Replace("ô", ChrW(147))
sb.Replace("ö", ChrW(148))
sb.Replace("ò", ChrW(149))
sb.Replace("û", ChrW(150))
sb.Replace("ù", ChrW(151))
sb.Replace("ÿ", ChrW(152))
sb.Replace("Ö", ChrW(153))
sb.Replace("Ü", ChrW(154))
sb.Replace("ø", ChrW(155))
sb.Replace("£", ChrW(156))
sb.Replace("Ø", ChrW(157))
sb.Replace("×", ChrW(158))
sb.Replace("ƒ", ChrW(159))
sb.Replace("á", ChrW(160))
sb.Replace("í", ChrW(161))
sb.Replace("ó", ChrW(162))
sb.Replace("ú", ChrW(163))
sb.Replace("ñ", ChrW(164))
sb.Replace("Ñ", ChrW(165))
sb.Replace("ª", ChrW(166))
sb.Replace("º", ChrW(167))
sb.Replace("¿", ChrW(168))
sb.Replace("®", ChrW(169))
sb.Replace("¬", ChrW(170))
sb.Replace("½", ChrW(171))
sb.Replace("½", ChrW(171))
sb.Replace("¼", ChrW(172))
sb.Replace("¡", ChrW(173))
sb.Replace("«", ChrW(174))
sb.Replace("»", ChrW(175))
sb.Replace("░", ChrW(176))
sb.Replace("▒", ChrW(177))
sb.Replace("▓", ChrW(178))
sb.Replace("│", ChrW(179))
sb.Replace("┤", ChrW(180))
sb.Replace("Á", ChrW(181))
sb.Replace("Â", ChrW(182))
sb.Replace("À", ChrW(183))
sb.Replace("©", ChrW(184))
sb.Replace("╣", ChrW(185))
sb.Replace("║", ChrW(186))
sb.Replace("╗", ChrW(187))
sb.Replace("╝", ChrW(188))
sb.Replace("¢", ChrW(189))
sb.Replace("¥", ChrW(190))
sb.Replace("┐", ChrW(191))
'Chrw(192) - Chrw(197) are box drawing characters
sb.Replace("ã", ChrW(198))
sb.Replace("Ã", ChrW(199))
'Chrw(200) - Chrw(206) are box drawing characters
sb.Replace("¤", ChrW(207))
sb.Replace("ð", ChrW(208))
sb.Replace("Ð", ChrW(209))
sb.Replace("Đ", ChrW(209))
sb.Replace("Ê", ChrW(210))
sb.Replace("Ë", ChrW(211))
sb.Replace("È", ChrW(212))
'Chrw(213) - lowercase dot less i has no html equiv
sb.Replace("ĺ", ChrW(214))
sb.Replace("&lcirc;", ChrW(215))
sb.Replace("&luml;", ChrW(216))
'Chrw(217) - Chrw(218) are box drawing characters
sb.Replace("█", ChrW(219))
sb.Replace("▄", ChrW(220))
sb.Replace("¦", ChrW(221))
sb.Replace("&brkbar;", ChrW(221))
sb.Replace("&lgrave;", ChrW(222))
sb.Replace("▀", ChrW(223))
sb.Replace("Ó", ChrW(224))
sb.Replace("ß", ChrW(225))
sb.Replace("Ô", ChrW(226))
sb.Replace("Ò", ChrW(227))
sb.Replace("õ", ChrW(228))
sb.Replace("Õ", ChrW(229))
sb.Replace("µ", ChrW(230))
sb.Replace("þ", ChrW(231))
sb.Replace("Þ", ChrW(232))
sb.Replace("Ú", ChrW(233))
sb.Replace("Û", ChrW(234))
sb.Replace("Ù", ChrW(235))
sb.Replace("ý", ChrW(236))
sb.Replace("Ý", ChrW(237))
sb.Replace("¯", ChrW(238))
sb.Replace("&hibar;", ChrW(238))
sb.Replace("´", ChrW(239))
sb.Replace("≡", ChrW(240))
sb.Replace("±", ChrW(241))
'ChrW(242) Double Underline , no html equiv
sb.Replace("¾", ChrW(243))
sb.Replace("¶", ChrW(244))
sb.Replace("§", ChrW(245))
sb.Replace("÷", ChrW(246))
sb.Replace("¸", ChrW(247))
sb.Replace("°", ChrW(248))
sb.Replace("¨", ChrW(249))
sb.Replace("¨", ChrW(249))
sb.Replace("·", ChrW(250))
sb.Replace("¹", ChrW(251))
sb.Replace("³", ChrW(252))
sb.Replace("²", ChrW(253))
sb.Replace("&spuf;", ChrW(254))
sb.Replace(" ", ChrW(255))
Return sb.ToString()
End Function
End Class