Page 1 of 1 1
Topic Options
#181118 - 2007-10-04 08:49 AM Bug in 4.60 - Strange characters returned from UDF when using Chr()
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
Dear Ruud et. al.,

I've found a strange bug in 4.60. Please check out the following code:

 Code:
Break On 

? Chr(151)+Chr(151)+Chr(151)
? Test
? Test2

Get $

Function Test

	For $i=1 to 3
		$Test=$Test+"-"
	Next
	
EndFunction

Function Test2

	For $i=1 to 3
		$Test2=$Test2+Chr(151)
	Next
	
EndFunction

Output:

 Code:
---
---
¶ --

Regards,

Richard

Top
#181120 - 2007-10-04 09:32 AM Re: Bug in 4.60 - Strange characters returned from function when using Chr() [Re: It_took_my_meds]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Nice catch.

It looks like there is a problem when assigning the value to an empty variable.

Here's a bit more evidence:
 Code:
"Kixtart Version: " @KIX ?
"Test one - catenate character on stack then display (no variable assignment)" ?
Chr(151)+Chr(151)+Chr(151) ?
 
"Test two = Catenate character on stack then assign to variable" ?
$foo=Chr(151)+Chr(151)+Chr(151)
"'"+$foo+"'=" while $foo Asc($foo) " " $foo=SubStr($foo,2) Loop ?
 
"Test three = Catenate character to variable one at a time" ?
$bar=Chr(151)
$bar=$bar+Chr(151)
$bar=$bar+Chr(151)
"'"+$bar+"'=" while $bar Asc($bar) " " $bar=SubStr($bar,2) Loop ?
 
"Test four - ASC / CHR on stack only (no variable assignment)" ?
"Asc(Chr(151))=" Asc(Chr(151)) ?


Using Kix 4.53:
 Code:
Kixtart Version: 4.53
Test one - catenate character on stack then display (no variable assignment)
---
Test two = Catenate character on stack then assign to variable
'---'=151 151 151
Test three = Catenate character to variable one at a time
'---'=151 151 151
Test four - ASC / CHR on stack only (no variable assignment)
Asc(Chr(151))=151


Using Kix 4.60:
 Code:
Kixtart Version: 4.60
Test one - catenate character on stack then display (no variable assignment)
---
Test two = Catenate character on stack then assign to variable
'¶ ¶ ¶ '=20 32 20 32 20 32
Test three = Catenate character to variable one at a time
'¶ --'=20 32 20 32 20 32
Test four - ASC / CHR on stack only (no variable assignment)
Asc(Chr(151))=151


Check out test three as it is especially freaky. The variable appears ok-ish when displayed on the console but it is definately not right - some sort of unicode weirdness maybe?

In all tests the variables appeared to be type plain strings (vartype=8)

Top
#181121 - 2007-10-04 09:33 AM Re: Bug in 4.60 - Strange characters returned from function when using Chr() [Re: It_took_my_meds]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Just did a test and I'm getting the same results. 4.53 is ok.

4.53
 Quote:

---
---
---

This is correct imho because the $test and $test2 vars are empty.

4.60
 Quote:

---
---
¶ --

Where is the first - and where does the paragraph sign come from?

4.60 gives me the same results you are getting so it looks like something is going wrong in 4.60.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181171 - 2007-10-05 08:16 PM Re: Bug in 4.60 - Strange characters returned from function when using Chr() [Re: Mart]
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Thanks for the report. Yes, this is changed behaviour (in 4.60) and is a result of some Unicode handling I added. I'm not sure it is a (big) problem. As far as I can tell, the issue only occurs with the non-printable/special characters (ranging from 128 to 160).

I'll put this on the research list for the next update.

Thanks again for the report.

Ruud

Top
#195667 - 2009-08-29 07:22 AM Re: Bug in 4.60 - Strange characters returned from function when using Chr() [Re: Ruud van Velsen]
It_took_my_meds Offline
Hey THIS is FUN
*****

Registered: 2003-05-07
Posts: 273
Loc: Sydney, Australia
FYI, this issue is still present in in 4.61RC1

Thanks

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 360 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.046 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.