getting String filesize in Coldfusion

Sometimes one needs to get the filesize of a string. For example when one wants to write this string into an Amazon SQS where there is a maximum limit of 256KB.

private numeric function getStringByteSize(required string text) {
 return ArrayLen( arguments.text.getBytes("UTF-8") );



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s