diff options
Diffstat (limited to 'strings/ctype-uca.inl')
-rw-r--r-- | strings/ctype-uca.inl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/strings/ctype-uca.inl b/strings/ctype-uca.inl index 6aa72847..62abbb9b 100644 --- a/strings/ctype-uca.inl +++ b/strings/ctype-uca.inl @@ -416,8 +416,20 @@ MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, flags & MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES ? my_space_weight(param->level) : 0; - res.nchars= 1; (*generated)++; + res.nchars++; /* Count all ignorable characters and the padded space */ + if (res.nchars > nchars) + { + /* + We scanned a number of ignorable characters at the end of the + string and reached the "nchars" limit, so the virtual padded space + does not fit. This is possible with CONCAT('a', x'00') with + nchars=2 on the second iteration when we scan the x'00'. + */ + if (param->cs->state & MY_CS_NOPAD) + res.weight= 0; + res.nchars= (uint) nchars; + } } else if (res.nchars > nchars) { |