Jump to content

Recommended Posts

Posted (edited)

what you want to know is how many characters are in the string that the variable represents

$var = "AutoIt"
msgbox(0, '' , stringlen($var))
Edited by boththose

  Reveal hidden contents

Posted

N.B.: That's only true as long as you use a single byte character set.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

A double-byte character set (DBCS) is a character encoding in which some/all characters are encoded in two bytes.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

No guys, StringLen counts the number of Unicode codepoints, not bytes. Once again, all AutoIt strings use UTF-16 (in fact and more precisely UCS-2) encoding.

  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted

I didn't realise it was UCS-2.

To confirm jchd's remark:

#include <Constants.au3>

MsgBox($mB_SYSTEMMODAL, '', Chr(194) & ': StringLen(' & StringLen(Chr(194)) & ')')

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Thanks jchd,

learned something new today.

Is this described somewhere in the help file? I checked "StringLen", "Datatypes" and "Unicode support" but couldn't find anything.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

water,

Report it or you can fix it yourself.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

For the record, UCS-2 is an older encoding standard having code units as 16-bit words. It is essentially equivalent to UTF-16 restricted to Unicode plane 0, i.e. the Basic Multilingual Plane where codepoints are reprented in UTF-16 as a single 16-bit word. The main difference between UTF-16 and UCS-2 is that the latter doesn't use surrogates.

For 99.9999% of all practical purposes UTF-16 and UCS-2 are equivalent and you can consider UCS-2 as representing Unicode, which it is technically not..

  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted
  On 2/16/2013 at 10:17 AM, 'guinness said:

Report it or you can fix it yourself.

Added
  Quote

All AutoIt strings use UTF-16 (in fact and more precisely UCS-2) encoding.

to files docs\autoit\english\html\intro\unicode.html and lang_datatype.htm

My UDFs and Tutorials:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...