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

Re: [Andy] Plugin Requested | Encode Email Addresses

Quote Reply
Re: [Andy] Plugin Requested | Encode Email Addresses In reply to
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
Subject Author Views Date
Thread Plugin Requested | Encode Email Addresses sangiro 11545 Jun 25, 2004, 12:42 PM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 11413 Jun 26, 2004, 5:04 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 11350 Jun 26, 2004, 6:25 AM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 11338 Jun 26, 2004, 6:34 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 11342 Jun 26, 2004, 7:03 AM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 11373 Jun 26, 2004, 7:17 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 11350 Jun 26, 2004, 7:33 AM
Thread Re: [sangiro] Plugin Requested | Encode Email Addresses
Andy 11301 Jun 26, 2004, 7:58 AM
Post Re: [Andy] Plugin Requested | Encode Email Addresses
sangiro 11298 Jun 26, 2004, 1:33 PM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 11217 Oct 22, 2004, 4:48 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 11226 Oct 22, 2004, 4:50 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 11163 Oct 22, 2004, 5:04 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 11178 Oct 22, 2004, 5:43 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 11146 Oct 22, 2004, 6:58 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 11160 Oct 22, 2004, 7:03 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 11181 Oct 23, 2004, 1:41 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 11193 Oct 23, 2004, 1:50 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 11139 Oct 23, 2004, 2:44 AM
Thread Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 11213 Oct 23, 2004, 2:54 AM
Thread Re: [Andy] Plugin Requested | Encode Email Addresses
mick31 11180 Oct 23, 2004, 4:47 AM
Post Re: [mick31] Plugin Requested | Encode Email Addresses
Andy 11154 Oct 23, 2004, 5:47 AM
Post Re: [mick31] Plugin Requested | Encode Email Addresses
sangiro 11186 Oct 22, 2004, 9:30 AM
Post Re: [sangiro] Plugin Requested | Encode Email Addresses
bigfish 11319 Jun 26, 2004, 9:25 AM