943,688 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 2611
  • PHP RSS
Sep 20th, 2008
0

Display correctly Greek and special characters

Expand Post »
I have a problem with my project.
The project search through the database and displays the results.
The problem is that I get question marks instead of GREEK letters (i do not mean rubbish, i mean Greek).
Suppose that the problem is not about encoding.
I have to find the command that displays the title of the product into the results page.
I finally found this :

PHP Syntax (Toggle Plain Text)
  1. $tplv['id']=$row['id'];
  2. $tplv['high']=$ISHIGHLIGHTED;
  3. $tplv['bold']=$ISBOLD;
  4. $tplv['idformat']="<A HREF=\"".$SETTINGS['siteurl']."item.php?id=".$row['id']."\">";
  5. if($ISHIGHLIGHTED) {
  6. $tplv['idformat'] .= "<SPAN CLASS=hg>";
  7. }
  8. if($ISBOLD) {
  9. $tplv['idformat'] .= "<B>";
  10. }
  11.  
  12. $tplv['idformat'] .= stripslashes(htmlspecialchars($row['title']));
  13. if($ISBOLD) {
  14. $tplv['idformat'] .= "</B>";
  15. }
  16. if($ISHIGHLIGHTED) {
  17. $tplv['idformat'] .= "</SPAN>";
  18. }
  19. $tplv['idformat'].= "</FONT></A>";

I guess the problem is
PHP Syntax (Toggle Plain Text)
  1. $tplv['idformat'] .= stripslashes(htmlspecialchars($row['title']));

Is there the right place to be?
Please get a view at http://gr2.php.net/htmlentities

I attach the file that includes the previous code.

Thank you
Attached Files
File Type: php browseitems.inc.php (4.6 KB, 26 views)
Reputation Points: 8
Solved Threads: 0
Light Poster
Punkis448 is offline Offline
31 posts
since May 2008
Sep 20th, 2008
0

Re: Display correctly Greek and special characters

The problem is not the database. I do import it with utf8 and all pages are utf8 encoded plus i used the meta charset tag.

The problem is with one single line
$tplv['idformat'].= stripslashes(htmlspecialchars($row['title']));
and changed it to
$tplv['idformat'].= stripslashes(htmlspecialchars($row['title'], ENT_COMPAT, "UTF-8"));

but again nothing happens.

Also, when i edit a page(e.g. my welcome page) where i write greek letters, it displayed correctly.
If i edit it again , my greek letters (only in editing mode) are written like
& # and three numbers, all without spaces.
Reputation Points: 8
Solved Threads: 0
Light Poster
Punkis448 is offline Offline
31 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Setting a width to a photo displayed from MySQL doesnt work
Next Thread in PHP Forum Timeline: Login Form





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC