Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug in VFP 6.0 on Pan-Chinese NT
Message
From
23/08/2001 11:23:17
 
 
To
22/08/2001 19:29:21
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00546905
Message ID:
00548011
Views:
13
Gavin, you miss the point. I am working with bytes not characters. The data is an C style array of DWORDs, not a Chinese character string. I am purposefully not using substrc() because it would return the wrong value.


>Hi Albert,
>
> I know that your example is using Roman Characters and I'm not sure if this will help, but instead of using SUBSTR() in your code you may want to try SUBSTRC() which is designed for expressions containing double-byte characters. Also have a look at DBCS in the help, this will show you what to take into consideration when working with DBCS.
>
>Hope this helps,
>Gavin...
>
>>The following code illustrates a bug in VFP 6.0 on Pan-Chinese NT 4.0 and probably other MBCS NTs. The problem does not occur on U.S. NT. This bug affects Ed Rauh's CLSHEAP library.
>>
>>
>>* the following fails on pan-chinese win nt 4.0 sp 5
>>* VFP 6.0 sp 5 ver. 06.00.8961.00
>>lowbyte = 192
>>hibyte = 63
>>word = chr(lowbyte) + chr(hibyte)
>>? "l",asc(substr(word, 1, 1)) && 192 - correct
>>? "h",asc(substr(word, 2, 1)) && 63 - correct
>>? "w",asc(substr(word, 1, 1)) + asc(substr(word, 2, 1)) * 256 && 16320 - correct
>>? "fWORDToNum1", fWORDToNum1(word) && 65342 - wrong
>>? "fWORDToNum2", fWORDToNum2(word) && 65342 - wrong
>>wait
>>
>>function fWORDToNum1
>>	*Take a binary WORD (16 bit USHORT) and convert it to a VFP Numeric
>>	lparameter tcWORD
>>	return asc(tcWORD) + bitlshift(asc(substr(tcWORD, 2, 1)), 8)
>>endfunc
>>
>>function fWORDToNum2
>>	*Take a binary WORD (16 bit USHORT) and convert it to a VFP Numeric
>>	lparameter tcWORD
>>	return asc(tcWORD) + asc(substr(tcWORD, 2, 1)) * 256
>>endfunc
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform