Take the 2-minute tour ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

This issue only happens once the site has been deployed to Production Server. On Development Environment works as expected.

Using Magento 1.6.2.0 CE, Locale: español (Spanish)

Search works just fine on Development Environment when using search terms that contain special characters (latin characters in this case: á, é, í, ó, ú, ñ, etc.), but when website is moved to Production Server, search breaks with special characters.

Everything else seems to be working fine, I haven't found any other encoding issue so far.

I tried adding AddDefaultCharset UTF-8 to .htaccess file with no avail.

I don't think it's a server configuration issue, because Production Server hosts other websites (mostly Joomla!) that fully support special characters in search terms.

For reference try to search for term with special characters like "brócoli" on http://caserisimo.mx

On Development Environment:

Development Environment

On Production Server:

Production Server

Any ideas?

Your help will be much appreciated.


** UPDATE **

I use a 301 redirect in .htaccess for URL trailing slashes removal with directives:

RewriteCond %{request_method} ^GET$
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)$ %1 [L,R=301]

Thanks to @MatthiasZeis great suggestion, I added the NE flag to the last directive, so now the RewriteRule is:

RewriteCond %{request_method} ^GET$
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)$ %1 [L,R=301,NE]

Works as expected now!

share|improve this question
    
Please mark @matthias' answer as correct if this solved your problem. –  philwinkle Jul 23 at 20:32

1 Answer 1

up vote 4 down vote accepted

The first thing I noticed was that the search returns an 301 redirect with the HTTP header Content-Type: text/html; charset=iso-8859-1 and the wrong URL http://caserisimo.mx/catalogsearch/result?q=br%25C3%25B3coli.

Your search result page has the correct UTF-8 content type. I guess you want to find out where that redirect is coming from.

share|improve this answer
    
I use a 301 redirect in .htaccess for URL trailing slashes removal. Do you think this could affect? –  carlitous Jul 23 at 17:37
    
I guess so. The browser sends the URL request http://caserisimo.mx/catalogsearch/result?q=br%C3%B3coli and the redirect transforms it to http://caserisimo.mx/catalogsearch/result?q=br%25C3%25B3coli (replacing % with %25). If you set back the URL in the browser location bar to caserisimo.mx/catalogsearch/result?q=br%C3%B3coli the search works. Did you set the NE flag when redirecting (see this answer)? –  Matthias Zeis Jul 23 at 17:45
    
I have updated my original question, your suggestion works like a charm, Matthias. –  carlitous Jul 23 at 18:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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