MAX-CHARS is actually max bytes

D.Cook

Member
I just thought I'd warn you.

You're probably thinking "So what, I live in the western world where we only have single-byte characters anyway".
WRONG! The windows line-break is two bytes, so don't expect to be able to enter 10 line-breaks in an editor with MAX-CHARS of 10. You'll only get 5.


I tried something like this to overcome the problem, but it doesn't seem to work..
Code:
on value-changed of cString in frame detail_frm 
   cString:screen-value = replace(cString:screen-value, "~r~n", "~n").
Hopefully I'll have time to revisit this later. Will probably need to create my own implementation of MAX-CHARS.
 
There is more to it: AFAIK most ( if not all ) the character functions that deal with number of characters are really number of bytes. You will get very well aware of it as soon as you use a code page which is double-byte enabled (UTF-8 for example). In that case you need to cater that.

Regards, RealHeavyDude.
 
Back
Top