diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index 92064922e6..0d7d82f1f5 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -1237,7 +1237,7 @@ class procedure TWin32WSCustomEdit.SetText(const AWinControl: TWinControl; var ACustomEdit: TCustomEdit absolute AWinControl; begin - if (ACustomEdit.MaxLength > 0) and (Length(AText) > ACustomEdit.MaxLength) then + if (ACustomEdit.MaxLength > 0) and (UTF8Length(AText) > ACustomEdit.MaxLength) then TWin32WSWinControl.SetText(ACustomEdit, UTF8Copy(AText, 1, ACustomEdit.MaxLength)) else TWin32WSWinControl.SetText(ACustomEdit, AText);