4D v11.8 & Active 4D v5.0r17
I am having a problem when saving information which includes CRs & LFs entered
in the browser (same results in Safari 5.0.3 & Firefox 3.6.13). The CR and LF
characters cannot be seen by the Position and Replace String commands.
Here's the test script I am working on (where $text replicates the value of the
textarea form variable):
$text:="one"+char(13)+char(10)+"two"+char(13)+char(10)+"three"
WRITE TO CONSOLE("test,1: = "+$text)
WRITE TO CONSOLE("test,2: length of text = "+length($text))
WRITE TO CONSOLE("test,3: ascii4 = "+ascii(substring($text;4;1)))
WRITE TO CONSOLE("test,4: ascii5 = "+ascii(substring($text;5;1)))
$length:=0
$pos:=position(char(13);$text;1;$length;*)
WRITE TO CONSOLE("test,5: position 13 = "+$pos)
$text:=replace string($text;char(13);"CR";*)
$text:=replace string($text;char(10);"LF";*)
WRITE TO CONSOLE("test,6: = "+$text)
and here are the results I get in the console:
test,1: = one
two
three
test,2: length of text = 15
test,3: ascii4 = 13
test,4: ascii5 = 10
test,5: position 13 = 0
test,6: = one
two
three
If I remove the char(10) from the $text I get the results I would expect and
all is well.
There seems to be a bug in both Position and Replace String. This code works
fine in 4D.
Any help would be gratefully received - I've been bashing my head over this for
2 days now!
cheers
Lisa
--
Lisa Pollard
Software Developer
Another Dimension Ltd
Needham Hall Barns, Needham Street
Gazeley, Newmarket, Suffolk. CB8 8RR
[email protected]
Tel: +44 1638 554450
URL: http://www.anotherdimension.co.uk
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/