Problem is that the jvm (where Lucee is on top) is handling all strings as unicode, so the charset only comes into the game when you read strings from outside the jvm or write them somewhere outside the jvm. Inside the jvm every letter uses one position, so that a certain letter uses 2 position when stored with a certain charset is completely independent. So what can you do? The easiest way is to convert the string to a byte array and get the length of that array like this:
// not tested
function bytelength(required string str, required string charset){
return arrayLen( arguments.str.getBytes(arguments. charset));
}
Then you can use this function to terminate the length and cut pieces of the string until you have the right length.
We should consider to extend the function stringLen with this...
Micha
--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/65c3b19b-9a9a-4843-9ad5-b2282bc949ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.