Convert string with parity to standard ASCII

Hello

I need to convert a string that has Even Parity added to it to printable ascii. However I am having problems in getting this working. Can anyone advise on how to achieve this in an iRule.

Thanks

James

Here’s the TCL that will do the encode

set plain_str "james was here ok"
puts "Plain String '$plain_str'"
set even_parity ""
foreach c [split $plain_str ""] { append even_parity [format %c [expr { ( [scan $c %c] & 127 ) + (!([scan $c %c] & 1)<<7)}]]}
puts "Even Parity '$even_parity'"

And here’s the decode:

set stripped_parity ""
foreach c [split $even_parity ""] { append stripped_parity [format %c [expr {[scan $c %c] & 127}]]}
puts "Stripped Parity '$stripped_parity'"

Output:

Plain String 'james was here ok'
Even Parity 'êames was èeòe ok'
Stripped Parity 'james was here ok'

James, Thank you for this I have been trying all sorts of variations to resolve this I wasn’t far off getting it right either. Thanks again.