[Gambas-user] Keyboard function skipped?

Benoit Minisini gambas at ...1...
Wed Jun 9 13:03:03 CEST 2004


On Wednesday 09 June 2004 12:44, Eilert wrote:
> Hi Benoit,
>
> I'm still trying to find out how long a string in TextArea1 is :-)
>
> What I need is the actual number of characters typed, not the number of
> what-so-ever stored.
>
> I found out that when I use ä, ö, ü and things like that, Gambas will
> always store 2 bytes. It doesn't even matter if I put them from the
> TextArea1 into a simple string variable (t$ = TextArea1.Text).
>
> len(TextArea1.Text) and len(t$) are always too long if characters other
> than simple ASCII were used.
>
> Any solution for that?
>
> Regards
> Rolf
>

You can try 

  Len(Conv$(TextArea1.Text, Desktop.Charset, System.Charset))

It should work, except on Fedora, where you should replace System.Charset by 
something like "ISO-8859-1". The idea is converting the UTF-8 string into a 
charset that uses only one byte per character.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list