Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Codepage problem
Message
De
20/09/2005 10:44:18
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Codepage problem
Divers
Thread ID:
01051301
Message ID:
01051301
Vues:
61
Hi all,
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)
ramil
~~ learning to stand still
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform