Advertisement:

Author Topic: Problem with special characters on page: search.php  (Read 6834 times)

Actarus

  • Newbie
  • *
  • Posts: 7
Problem with special characters on page: search.php
« on: July 26, 2013, 08:50:49 pm »
Hi all,

I just install the new version of OsClass and in the search.php file a noticed a problem here: <h1><?php echo search_title(); ?></h1> on line 68.

I have created a catégory named "Hôtel" (in french) and there is a problem with the "ô" same for an other category with an "é".

Thank you for your help!

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Problem with special characters on page: search.php
« Reply #1 on: July 29, 2013, 11:12:29 am »
Hi Actarus,

I can not reproduce the problem : http://i.imgur.com/3YvCL10.png In my setup it shows correctly.

Did you modify the theme? In that case, please check that the encoding of the file is set to UTF-8

Actarus

  • Newbie
  • *
  • Posts: 7
Re: Problem with special characters on page: search.php
« Reply #2 on: July 29, 2013, 02:27:17 pm »
Hi Esteban,

I did not change anything  :-[
I create the DB using utf8_general_ci and the characters in DB are rights and everywhere in the sites too but it's only wrong in that title...

Thank you for your help.

Gilden

  • Sr. Member
  • ****
  • Posts: 464
  • Availability: 30%
Re: Problem with special characters on page: search.php
« Reply #3 on: July 29, 2013, 03:14:14 pm »
Make sure all the files in your theme (and Osclass as well) are encoded in utf8. This happens to me when I save a file in another format (like Latin or something).

Actarus

  • Newbie
  • *
  • Posts: 7
Re: Problem with special characters on page: search.php
« Reply #4 on: July 29, 2013, 03:26:07 pm »
I tried to install OsClass on my web server and the problem is not here. So the problem is on local install with Wamp...

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Problem with special characters on page: search.php
« Reply #5 on: July 29, 2013, 03:28:31 pm »
Please, check the encoding of the files (with your text editor > save as ) and the encoding of the page being served (In chrome click on the settings menu > Tools > Encoding)

Actarus

  • Newbie
  • *
  • Posts: 7
Re: Problem with special characters on page: search.php
« Reply #6 on: July 29, 2013, 03:41:37 pm »
All in UTF-8. I'll try to update my Wamp, I think it will solve the problem... 

Actarus

  • Newbie
  • *
  • Posts: 7
Re: Problem with special characters on page: search.php
« Reply #7 on: July 29, 2013, 04:15:25 pm »
I updated my Wamp from 2.1 to the latest and it works fine now.

Thank you all for your help

seoadd

  • Newbie
  • *
  • Posts: 13
  • Freelance Osclass pr99.ru
Re: Problem with special characters on page: search.php
« Reply #8 on: December 06, 2013, 04:42:14 pm »
Insert the file .htaccess

Code: [Select]
AddDefaultCharset utf-8

<IfModule mod_charset.c>
CharsetDIsable on
CharsetRecodeMultipartForms Off
</IfModule>

php_value mbstring.func_overload 2
php_value mbstring.language Russian
php_value mbstring.http_input "UTF-8,KOI8-R,CP1251"
php_value mbstring.detect_order "UTF-8,KOI8-R,CP1251"

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: Problem with special characters on page: search.php
« Reply #9 on: December 06, 2013, 05:40:48 pm »
@Actarus
Try to set everything on UTF-8 and reinstall osclass...

InstaladorX

  • Full Member
  • ***
  • Posts: 109
  • I live without rest! Osclass 3.2.1 Theme Bender
Re: Problem with special characters on page: search.php
« Reply #10 on: December 20, 2013, 07:10:32 pm »
I'm looking at this problem and is only on display the title of the search.php page.

At the mostall on page is correctly with accents!

When you create a new category with accented characters, they are correct in DB. Also on the homepage are correct but, in preview from search.php, on this quoted line, are not.

I had launched tidy in all categories directly in the DB but now I will go back.

Everything is correct except

Code: [Select]
<php echo search_title ();?>
why?

I guarantee that's not a problem page, because everything else has accents in search.php.

What is not accented, is just the search_title().

I did so:

I created a category with any accents:

"Está caçado o pão"

So in the abovementioned line I added the letters with accents + title:

Code: [Select]
<h1><?php echo _e('â ã á ção é ---- '.search_title()); ?></h1>
The search results on page was this:

â ã á ção é ---- Est�� ca��ado o p��o

Happens both local server and web server.

The strange thing is that the same function in all other places, such as: Breadcrumb and Home webpage are correct!

This is very annoying!
« Last Edit: December 20, 2013, 07:54:01 pm by InstaladorX »

InstaladorX

  • Full Member
  • ***
  • Posts: 109
  • I live without rest! Osclass 3.2.1 Theme Bender
Re: Problem with special characters on page: search.php
« Reply #11 on: December 20, 2013, 10:01:48 pm »
THE SOLUTION

The problem lies in using: strtolower() which is based on unicode.

to solve this, you must use: mb_strtolower()

Then, check the file oc-includes/osclass/functions.php

Find the line:

Code: [Select]
$result .= strtolower($cat['s_name']) . ' ';
and replace with:

Code: [Select]
$result .= mb_strtolower($cat['s_name'], 'UTF-8') . ' ';
Do this for all within the function.php file!

Including for the function: osc_search_category_id()

Code: [Select]
$text .= strtolower($cat['s_name']) . ' ';
to:

Code: [Select]
$text .= mb_strtolower($cat['s_name'], 'UTF-8') . ' ';
and where you find more convinient.

 8) Go beyond!

Nosaint

  • Newbie
  • *
  • Posts: 7
Re: Problem with special characters on page: search.php
« Reply #12 on: March 07, 2015, 09:39:47 am »
In css try and change the font for h1,h2,h3,h4,h5,h6 from osclass to helvetica or another font that has diacritics