0

I have a website with the content management system GetSimple which is written in PHP. I edited it as I needed, however, in the header, this is what is supposed to be there:

<title><?php get_page_clean_title(); ?> - <?php get_site_name(); ?></title>

The problem is that I am Czech and I have to use special characters (á, é, í, ó, ú, ů, ě, š etc.) and if you opened my website and saw the source code, you would see this:

<title>Tomáš Janeček - osobní web - Tom**&aacute;&scaron;** Janeček | Personal Website</title>

Instead of "Tomáš Janeček - osobní web - Tom*áš* Janeček | Personal Website". What is bothering me are those HTML entities, which are only in the second part of the title. á stands for "á" and š stands for "š". I know it's supposed not to hurt SEO, but I'm doing this to keep the code clear.

Is there a way to decode it or just change the get_site_name() to some better function that would have no problems with these extra characters? I don't want the entities in my code. I think that it's not this concrete .php file that should be edited to make it as I want it to be, however, I hope it could be solved somehow simply in this file. The CMS includes tens of .php files and I'm not sure what should I search for. I've looked for some code with PHP entities in "suspicious" files but I found nothing that helped me. If you need it, the whole CMS can be downloaded here

Thanks for your help in advance.

Edit1:// --------------------------------------------------------------------------------------

Of course I have this meta included.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

And no, I don't use any database. That will come with studying Joomla! :)

I want to emphasize that the title has 2 parts - get_page_clean_title() and get_site_name(), both of them include my whole name and only one displays it in the source code with HTML entities.

I have found the functions in another file:

The FIRST one is the one that doesn't put HTML entities into the source code - this is what I want from the second function lower.

function get_page_clean_title($echo=true) {
global $title;
$myVar = strip_tags(strip_decode($title));

if ($echo) {
    echo $myVar;
} else {
    return $myVar;
}

}

The SECOND function does what it is supposed to do, but it gives the output with HTML entities and that is the problem.

function get_site_name($echo=true) {
global $SITENAME;
$myVar = trim(stripslashes($SITENAME));

if ($echo) {
    echo $myVar;
} else {
    return $myVar;
}

}

Both of the functions above are in the same file.

I tried to replace the problematic function with the one working well with changing variables names to the right values, however, it stopped working at all :/

So, to conclude, the whole page is OK, there are no HTML entities except one place - the second half of the title with get_site_name function.

Furthermore, the problems is ONLY at the SOURCE CODE. The final displaying is okay.

Thanks for your replies so far, I'm glad for such fast and valuable replies. I really appreciate that.

TeeJay
  • 1,593
  • 3
  • 21
  • 33
  • Where does the information come from? If it is a database, are both values (for example title and site name) stored in the same way? – jeroen Mar 13 '13 at 20:21
  • No, it's not a database. The first title is from .PHP file and the second title is the final source code of an opened working website. – TeeJay Mar 13 '13 at 22:28
  • Then you need to check the source of the data and see if the `get_site_name()` function uses `htmlentities`. – jeroen Mar 13 '13 at 22:32
  • I did as you can see above in my edited comment. However, I don't know if it's all, there are so many files. These functions were found in themes_functions.php :) – TeeJay Mar 13 '13 at 22:44
  • @TeeJay where is `$SITENAME` defined and which is it's value? – Ander2 Mar 13 '13 at 22:54
  • I've searched through another couple of files with Ctrl + F and have found this: $SITENAME = stripslashes($dataw->SITENAME); :) – TeeJay Mar 13 '13 at 22:59

2 Answers2

1

I think you have a charset problem. If you want the special characters to display them in the right way, add

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

to your html/php file. Also check that your data is UTF-8 codified.

If you are getting your data from a MySQL database, check the columns use utf-8charset. Also set the charset for the connection with this query to ensure you are getting the data with the right codification.

set names utf8;
Ander2
  • 5,569
  • 2
  • 23
  • 42
  • 2
    `header('Content-Type: text/html; charset="UTF-8"');` (Make sure your backend is sending the right headers) – Xeoncross Mar 13 '13 at 20:26
  • I don't think so, I have charset set up exactly as you propose. And no, there is no database in this CMS. – TeeJay Mar 13 '13 at 22:30
  • @TeeJay Can you check web server's default charset? It is posible that your data and header to be fine but the web server be forced to use a charset different from your's. – Ander2 Mar 13 '13 at 22:32
  • It's my virtual server done with XAMPP. The default_charset has no value there. I also have the web on a freehosting as you can see in my profile or directly on my website [link](http://tomas-janecek.php5.cz/), but I don't know how to find out the server's default. – TeeJay Mar 13 '13 at 22:41
  • Thanks. I was hoping so. Now I will have to play with the functions I copied into my first post I think. – TeeJay Mar 13 '13 at 22:50
0

Tome, ensure that your *.php or database or whatever data is going off, is in UTF-8 and your meta charset on index is utf-8 also.

http://www.jakpsatweb.cz/cestina.html - Please visit this web for information about diacritics in html. You'll see the table of signs in each encoding.

How to save Russian characters in a UTF-8 encoded file

Community
  • 1
  • 1
Stepo
  • 1,036
  • 1
  • 13
  • 24
  • Thanks for the tip, I know the web. However, my problem is not a HTML thing, it's somewhere the PHP. The HTML is okay since the text in the and

    is working well. See me edited above.
    – TeeJay Mar 13 '13 at 22:16