diff --git a/src/Functions/padString.cpp b/src/Functions/padString.cpp index 7a424bb1198..119baaec723 100644 --- a/src/Functions/padString.cpp +++ b/src/Functions/padString.cpp @@ -241,7 +241,7 @@ namespace bool all_ascii = UTF8::isAllASCII(reinterpret_cast(pad_string.data()), pad_string.size()) && UTF8::isAllASCII(chars.data(), chars.size()); - if (all_ascii) + if (!is_utf8 || all_ascii) { PaddingChars padding_chars{pad_string}; if (const auto * col_const = checkAndGetColumn(column_length.get())) diff --git a/src/Functions/substring.cpp b/src/Functions/substring.cpp index 759d41e2ab8..122f83d758b 100644 --- a/src/Functions/substring.cpp +++ b/src/Functions/substring.cpp @@ -161,9 +161,9 @@ public: StringRef str_ref = col_const->getDataAt(0); bool all_ascii = UTF8::isAllASCII(reinterpret_cast(str_ref.data), str_ref.size); if (all_ascii) - return executeForSource(column_offset, column_length, column_offset_const, column_length_const, offset, length, ConstSource(*col_const), input_rows_count); - else return executeForSource(column_offset, column_length, column_offset_const, column_length_const, offset, length, ConstSource(*col_const), input_rows_count); + else + return executeForSource(column_offset, column_length, column_offset_const, column_length_const, offset, length, ConstSource(*col_const), input_rows_count); } throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column {} of first argument of function {}", arguments[0].column->getName(), getName()); }