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

mariuss’s picture

Thanks 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?

mariuss’s picture

Assigned: Unassigned » mariuss
Status: Active » Fixed

Just committed a fix, using drupal_strlen and drupal_substr.

Let me know if everything is OK, including the JavaScript part.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Gidgidonihah’s picture

Version: 5.x-1.x-dev » 5.x-1.0
Status: Closed (fixed) » Active

This 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:

Groundwater model ages typically use an assumed value for δ13CPDB of soil gas
that ranges from -15 to -25‰. A sensitivity study using the Pearson model shows that
apparent ages can range over 4500 years using activities of 13.6 ppm (sample), and 24.52
ppm (initial activity). To obtain a more accurate input for groundwater model ages, δ13C
values in soil gas from a large variety of environmental variables are being measured
throughout Utah.
Preliminary results show that, with two exceptions, δ13C values range throughout
the state between -19 and -24‰ with an average of -21.5±0.1‰ and a mean standard
deviation of 1.3‰.
There are no strong correlations between δ13C values and environmental
parameters other than the indirect relationship of plant community to elevation, latitude,
etc. Rather, it appears that as long as the plant community represents a single metabolic
type (C3, C4, or CAMS), a single value can be used over a broad range of elevation,
latitude, and season as long as typical values are characterized.

When the error is returned, 'zed.' is truncated off the end.

mariuss’s picture

Copied 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)?

Gidgidonihah’s picture

Sorry, 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.

Gidgidonihah’s picture

This issue is still active. Has any progress been made?

simon georges’s picture

Status: Active » Closed (won't fix)

This 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.