Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CHR() function in VFP 9.0

Status
Not open for further replies.

Pollock

Programmer
Jun 2, 2000
49
CA
Hello, just upgraded from VFP 6 to 9 today and have come across something really wierd.
The following code
enc_str = ''
for i=255 to 1 step -1
enc_str=enc_str + chr(i)
endfor


Returns a totally different result when run in VFP 9.0 then when it runs in VFP 6.0.

Would anybody know the cause of this.
 
I ran that in both and got:
VFP6 said:
ÿþýüûúùø÷öõôóòñðïîíìëêéèçæåäãâáàßÞÝÜÛÚÙØ×ÖÕÔÓÒÑÐÏÎÍÌËÊÉÈÇÆÅÄÃÂÁÀ¿¾½¼»º¹¸·¶µ´³²±°¯®­¬«ª©¨§¦¥¤£¢¡ Ÿž?œ›š™˜—–•”“’‘??Ž?Œ‹Š‰ˆ‡†…„ƒ‚?€~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! 


and in VFP 9
vfp9 said:
ÿþýüûúùø÷öõôóòñðïîíìëêéèçæåäãâáàßÞÝÜÛÚÙØ×ÖÕÔÓÒÑÐÏÎÍÌËÊÉÈÇÆÅÄÃÂÁÀ¿¾½¼»º¹¸·¶µ´³²±°¯®­¬«ª©¨§¦¥¤£¢¡ Ÿž?œ›š™˜—–•”“’‘??Ž?Œ‹Š‰ˆ‡†…„ƒ‚?€~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! 




Regards

Griff
Keep [Smile]ing
 
Ok, I tried what you said, and it does look the same, but i was looking at them in step by step debug mode and it displayed 2 totally different sets of results?
 
ok, if it then not that command, has sys(15) changed in anyway, as those are the only two functions that i use in this procedure
 
>>Ok, I tried what you said, and it does look the same, but i was looking at them in step by step debug mode and it displayed 2 totally different sets of results?

What you get for the characters above 128 depends on the font. I would guess that in VFP 6 you have the debugger set to use either FoxFont or Courier New, while in VFP 9 it is probably the default (MS Sans Serif) - or the other way around...:)

----
Andy Kramek
Visual FoxPro MVP
 
As AndyKr explained, it has to do with Fonts and Charater Set.

Search for 'Code Page' in the vfp 9.0 help file. Also look at the 'Programs/Accessories/SystemTools/Character Map' of your Windows.

enc_str = ''
for i=127 to 255
enc_str=enc_str + ltrim(str(i))+' ' + chr(i)+', '
endfor

When you print this, you may get different results as well.

This is all related to code page.


 
Ok, dumped the output to a file and look at both, they appear to be identical. yet when i use sys(15) to modify the string, it delivers different output in vfp 6 as opposed to vfp 9. Anybody have an idea why?
 
Hi Pollock:

Would you please find one char which is different. What is the ascii code for that.

Once located the char, then go to windows find both chars in the character map, as mentioned earlier. Post the charater map ascii for both chars.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top