create table test (f1 i, f2 m NOCPTRANS )>I think I copied this encryption routine from one of the files in UT. It has been working for us fine until it was deployed to a client using the 1251 codepage. This is a code snippet to reproduce the problem. I've been using the CPCONVERT() to try to fix the problem but cannot. Is there something I can do? Creating temporary tables/cursors is a valid solution for me.
>close databases all >create table test (f1 i, f2 m) >copy to test2 && as 1251 && uncomment to create the problem. >use in test >use test2 > >* encrypts >x=asc('+') >y=0 >for bit=7 to 0 step -1 > if x>((2^bit)-1) > x=x-(2^bit) > y=y+(2^(7-bit)) > endif >endfor >insert into test2 (f2) values (chr(y)) && stores the encrypted value to the memo. > >* decrypts >x=asc(f2) >y=0 >for bit=7 to 0 step -1 > if x>((2^bit)-1) > x=x-(2^bit) > y=y+(2^(7-bit)) > endif >endfor >?chr(y) >