Home : Products : Gossamer Forum : Development, Plugins and Globals :

Products: Gossamer Forum: Development, Plugins and Globals: Re: [Andy] Plugin Requested | Encode Email Addresses: Edit Log

Here is the list of edits for this post
Re: [Andy] Plugin Requested | Encode Email Addresses
Andy,

I've added some upper case and special characters to your global. It's still not all of them but includes most except the "really weird" ones.

Would still like to see the other option in action. Smile

Code:
sub {

my $in = $_[0];
my $strings = q|
~032
&~038
+~043
-~045
.~046
0~048
1~049
2~050
3~051
4~052
5~053
6~054
7~055
8~056
9~057
:~058
;~059
@~064
A~065
B~066
C~067
D~068
E~069
F~070
G~071
H~072
I~073
J~074
K~075
L~076
M~077
N~078
O~079
P~080
Q~081
R~082
S~083
T~084
U~085
V~086
W~087
X~088
Y~089
Z~090
^~094
_~095
a~097
b~098
c~099
d~100
e~101
f~102
g~103
h~104
i~105
j~106
k~107
l~108
m~109
n~110
o~111
p~112
q~113
r~114
s~115
t~116
u~117
v~118
w~119
x~120
y~121
z~122
?~127
~130
~132
~138
~139
~142
~145
~146
~147
~148
~149
~150
~151
~152
~154
~155
~158
~159
~160
~161
~168
~175
~176
~180
~183
~192
~193
~194
~195
~196
~197
~198
~199
~200
~201
?~202
~203
~204
~205
~206
~207
~208
~209
~210
~211
~212
~213
~214
~215
~216
~217
~218
~219
~220
~221
~222
~223
~224
~225
~226
~227
~228
~229
~230
~231
~232
~233
~234
~235
~236
~237
~238
~239
~240
~241
~242
~243
~244
~245
~246
~247
~248
~249
~250
~251
~252
~253
~254
~255
|;

my $back;
my @address = split //, $in; # cut the email address up into each charachter...
my @strings = split /\n/, $strings;

foreach (@address) {

my $next;

foreach my $s (@strings) {

$s =~ s/\s$//g;

next if $next == 1;

my ($char,$equiv) = split /~/, $s; # get the charachter, and its numerical equiv

if ($char eq $_) {
$char =~ s/\Q$char/$equiv/i;
$char = '&#' . $char . ';';
$back .= $char; # add the new replacement to $back
$next = 1;
}

}

}

return \$back;

}

Safe swoops
Sangiro

Last edited by:

sangiro: Jun 26, 2004, 2:49 PM

Edit Log: