You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
When realText generates a string that ends with some specific character (for example, р (U+0440) in ru_RU or uk_UA locale; є (U+0454) in uk_UA locale) this character becomes broken.
And when I trying to insert generated string into mysql database I get an error: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xD1.'
Looks like this happens because of rtrim($text, ',— ') in appendEnd method.
Em dash — is not an ASCII character so it can cause problems there.
rtrim doesn't understand — as one character, but 3 bytes (E2 80 94) and it will trim any of those bytes individually.
So, when text ends with р character (it has hex representation D1 80) rtrim cuts 'half a char' from it: D180 and it becomes broken.
I think changing rtrim to preg_replace will solve the issue.
The text was updated successfully, but these errors were encountered:
When
realText
generates a string that ends with some specific character (for example,р
(U+0440) inru_RU
oruk_UA
locale;є
(U+0454) inuk_UA
locale) this character becomes broken.And when I trying to insert generated string into mysql database I get an error:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xD1.'
Here is how to reproduce it:
Looks like this happens because of
rtrim($text, ',— ')
inappendEnd
method.Em dash
—
is not an ASCII character so it can cause problems there.rtrim
doesn't understand—
as one character, but 3 bytes (E2 80 94
) and it will trim any of those bytes individually.So, when text ends with
р
character (it has hex representationD1 80
)rtrim
cuts 'half a char' from it:D1
and it becomes broken.80
I think changing
rtrim
topreg_replace
will solve the issue.The text was updated successfully, but these errors were encountered: