Exactly what problem are you having? When you use a String, you are always dealing with characters, not with bytes. Are you actually using a ByteArray rather than a String? How are you putting a ByteArray into a TextArea? - Gordon
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Farland Sent: Friday, June 08, 2007 10:15 AM To: [email protected] Subject: RE: [flexcoders] AS3 method exist returning the # of bytes a String is? It would depend on the character set encoding. You'd need to know which encoding was used in order to determine the "number of bytes" of a stored String. For example, if you wanted to get the length of a UTF-8 encoded String, you could do something like this: var ba:ByteArray = new ByteArray(); var ba.writeUTFBytes(stringValue); ba.position = 0; // Remember to rewind to position 0 if you plan to use the bytes var length:uint = ba.length; On the other hand, as another example, UTF-16 would be 2-bytes per character no matter whether it was code point was less than 128. etc. etc.. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of e_baggg Sent: Friday, June 08, 2007 1:05 PM To: [email protected] Subject: [flexcoders] AS3 method exist returning the # of bytes a String is? I am implementing a spell checker and am hitting some issues because for non-Ascii characters such as "ò"...this is actually two bytes where a normal character is 1 byte...which throws off the start and end index of the text in the textArea. Do any Flash/AS3 methods exist that return the number of bytes a given String is? Or do I need to create my own loop counting each character and if the charCode is >= 128...then it is 2 bytes? Thanks in advance.

