When a result title contains character single/double quote character ('/"), the last character of the title will be cut.
My friend's pencil
My friend's penci
The problem is from the highlight method in the script /components/com_search/views/search/view.html.php
I observe this problem in my current Joomla in version 3.9.24, I don't know if the problem was early.
At the moment, I remove the title highlighting to replace the ligne 165,
$result->title = $rowTitleHighLighted;
by
$result->title = $rowTitle;
Labels |
Added:
?
|
Hi,
Thank you for the reply.
I tested, it's work fine for single quote. So I have the same problem with the double quote. So I changed the line :
return preg_replace("/([a-z])/ui", '\1', $str);
Thank you and have a nice day.
I tested, it's work fine for single quote. So I have the same problem with the double quote. So I changed the line :
return preg_replace("/([a-z])/ui", '\1', $str);
Then it seems to me the preg_replace is not needed at all. Or am I missing something? @infograf768 What do you think?
@richard67 I think you are right. I didn't read all the line.
So I replace all the line and it works fine :
return $str ;
The question is if that is right and desired. I have no idea.
Just know that the method call remove_accents($str)
, It must remove accent characters, but I've never used ui
in regex yet.
u is for unicode dependent
i is for ignore case
Also,
$str = JLanguageTransliterate::utf8_latin_to_ascii($str);
is the part that takes off accents from the latin1 and latin2 strings
So what do we need the regex for? If we remove single and double quotes from the pattern, it will remain return preg_replace("/[^]([a-z])/ui", '\1', $str);
, i.e. strip off any ^
. Would that be right and sufficient?
But then the ^
should be escaped, i.e. preg_replace("/[^]([a-z])/ui", '\1', $str);
. Or was that meant to be the beginning of the string? Then it should be preg_replace("/^([a-z])/ui", '\1', $str);
, but then the preg_replace
is useless, or not?
Hey! I am just beginning to work on open source can you guide me please?
@saumyahada welcome to Joomla and thank you for trying to contribute to open source.
First thing: github is the place to share code, create issues (when something doesn't work as expected) and pull requests (the solution to the bug), but it is not the place to ask support questions. You can start reading the Joomla documentation (https://docs.joomla.org) and you can use the forum to ask questions (https://forum.joomla.org).
If you are a student wanting to apply to GSoC, you should contact the team (https://docs.joomla.org/GSoC_2021)
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-03-12 09:16:47 |
Closed_By | ⇒ | richard67 | |
Labels |
Added:
?
Removed: ? |
In fact it comes from
joomla-cms/administrator/components/com_search/helpers/search.php
Lines 263 to 269 in c2570c2
This takes off the single quote.
If we change to
return preg_replace("/[\"^]([a-z])/ui", '\1', $str);
it should work.
Please test.
@joomla/cms-maintainers
Any undesired consequences to that change?