Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Codepage problem
Message
From
20/09/2005 10:54:22
 
 
To
20/09/2005 10:44:18
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01051301
Message ID:
01051307
Views:
10
This message has been marked as a message which has helped to the initial question of the thread.
Use Character Binary fields for this, and VFP won't change the data for you.

>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)
>
Previous
Reply
Map
View

Click here to load this message in the networking platform