Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Codepage problem
Message
 
 
À
20/09/2005 10:44:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01051301
Message ID:
01051304
Vues:
15
This message has been marked as the solution to the initial question of the thread.
The encrypted fields should be defined with NOCPTRANS clause to avoid code page translation.
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)
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform