Please, do not forget about non-english users.
Using drupal_strlen() or mb_strlen() instead of strlen() is the solution of a bug described on the title.
I hope you'll correct this in next release.
Please, do not forget about non-english users.
Using drupal_strlen() or mb_strlen() instead of strlen() is the solution of a bug described on the title.
I hope you'll correct this in next release.
Comments
Comment #1
mariuss commentedThanks for this bug report, will fix soon.
Only the PHP code is affected? How about the JavaScript code that does the live count, does that work OK?
Comment #2
mariuss commentedJust committed a fix, using drupal_strlen and drupal_substr.
Let me know if everything is OK, including the JavaScript part.
Comment #3
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #4
Gidgidonihah commentedThis is not completely fixed. I'm using 5.x-1.0 Maxlength (the latest download) on my site and some items are being truncated when they shouldn't. For reference I'll paste the content here. The limit was supposed to be 1035, but php is truncating this content to 1009.
It is only 1013 charaters. Javasript will let me enter the corrent info, but the php truncates it and returns an error.
The content that was entered:
When the error is returned, 'zed.' is truncated off the end.
Comment #5
mariuss commentedCopied the sample text as is to a text editor, on Linux. Got the following stats:
- Lines: 14
- Words: 182
- Characters: 1026
- Bytes: 1039
Assuming the above is correct (you mention 1013 characters, while I see 1026, 13 more) the four truncated characters at the end could come from 1039 - 1035. Strange that 1039 - 1026 is also 13.
Can you add debug statements inside drupal_strlen and see what version is used (mb_strlen vs preg_replace)?
Comment #6
Gidgidonihah commentedSorry, I show 1026 now, not 1013. Dunno why I showed that yesterday.
Anyway, what do you have in mind for debug statements?
I added a simple 'print' call and only ever showed the mb_strlen being called.
Comment #7
Gidgidonihah commentedThis issue is still active. Has any progress been made?
Comment #8
simon georges commentedThis version of Maxlength is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.