4

I'm having a bit of a situation here, because of encoding. This problem occurs only on internet explorer (yes, that guy ...).

I'm using the search component, which works nice by the way, but whenever I try to search something with, let's say, an accent, everything goes wrong on IE, because that character doesn't get encoded.

For an example, I'm searching "crédit", so the URL that gets generated is :

http://mywebsite.com/index.php/search-result?searchword=crédit&searchphrase=all

I'd like to have the encoded version, which should be :

http://mywebsite.com/index.php/search-result?searchword=cr%C3%A9dit&searchphrase=all

However, I can't manage to find where I could change that. Of course, I want to do it as good as possible, which means not modifying any of the Joomla core file, or base components/modules/plugins.

Long story short, I sighted an event which could help me : onSearch, however I can't find any example of it and can't get it working.

PS : Joomla 3.5 here.

2
  • What version of Internet Explorer?
    – Lodder
    Commented Aug 16, 2016 at 13:05
  • IE 11, I'm not the kind of guy trying to get anything to work below that
    – soenguy
    Commented Aug 16, 2016 at 15:12

1 Answer 1

5

Copy the file /modules/mod_search/tmpl/default.php to templates/joomla-template/html/mod_search (make sure that the file doesn't exist under the destination directory first)

Add the following to the form tag:

enctype="application/x-www-form-urlencoded"

So, your form tag should be something like:

<form action="<?php echo JRoute::_('index.php');?>" method="post" enctype="application/x-www-form-urlencoded">

Hope this helps!

2
  • 1
    Did just that but on the com_search/tmpl/default_form.php Works like a charm ! Thanks, didn't know this trick ! :)
    – soenguy
    Commented Aug 16, 2016 at 15:11
  • For me it did not work in Edge, but it does in IE =< IE11. Although in Joomla 1.7 search did work correctly without adding this enctype
    – bumerang
    Commented Jan 18, 2017 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.