Author |
Message |
slackervaara
Worker


Joined: Aug 26, 2007
Posts: 236
|
Posted:
Tue Nov 17, 2009 12:03 pm |
|
I have problems when adding the Swedish National Characters ÅÄÖ in the alphabet of the Reviews module, but it works on my local site on my PC with Xampp, but it does not work on the webb hotel with the identical index.php.
This is from the index.php of Reviews module:
Code:
$alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M",
"N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Å","Ä","Ö","1","2","3","4","5","6","7","8","9","0");
|
The letters looks OK, when I am in Reviews:
When I click on Ä in the local site, I can see the books that starts with this letter.
When I click on Ä on the web hotel, I just can see the index-page again. Nothing happens, but the other letters like V works normally and displays books that starts with V.
I have checked the database query and it works for the web hotell and displays books for letter Ä.
It seems that it must be the php-code that are triggered by clicking on Ä that is not working because it is a non-english letter.
I think it must be this code:
Code:
function reviews($letter, $field, $order) {
global $bgcolor4, $sitename, $prefix, $multilingual, $currentlang, $db, $module_name;
include('header.php');
$letter = substr("$letter", 0,1);
if ($multilingual == 1) {
$querylang = "AND rlanguage='$currentlang'";
} else {
$querylang = "";
}
OpenTable();
echo "<center><b>$sitename "._REVIEWS."</b><br>";
echo "<i>"._REVIEWSLETTER." \"$letter\"</i><br><br>";
switch ($field) {
case "reviewer":
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by reviewer $order");
break;
case "score":
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by score $order");
break;
case "hits":
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by hits $order");
break;
default:
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
break;
}
$numresults = $db->sql_numrows($result);
if ($numresults == 0) {
echo "<i><b>"._NOREVIEWS." \"$letter\"</b></i><br><br>";
} elseif ($numresults > 0) {
echo "<TABLE BORDER=\"0\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"4\">
<tr>
<td width=\"50%\" bgcolor=\"$bgcolor4\">
<P ALIGN=\"LEFT\"><a href=\"modules.php?name=$module_name&rop=$letter&field=title&order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._PRODUCTTITLE." </B><a href=\"modules.php?name=$module_name&rop=$letter&field=title&order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
</td>
<td width=\"18%\" bgcolor=\"$bgcolor4\">
<P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&rop=$letter&field=reviewer&order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._REVIEWER." </B><a href=\"modules.php?name=$module_name&rop=$letter&field=reviewer&order=desc\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
</td>
<td width=\"18%\" bgcolor=\"$bgcolor4\">
<P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&rop=$letter&field=score&order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._SCORE." </B><a href=\"modules.php?name=$module_name&rop=$letter&field=score&order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
</td>
<td width=\"14%\" bgcolor=\"$bgcolor4\">
<P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&rop=$letter&field=hits&order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._HITS." </B><a href=\"modules.php?name=$module_name&rop=$letter&field=hits&order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
</td>
</tr>";
|
PHP 5.2.4 on my local site
PHP 5.2.10 on my web hotel
Has anyone any idea here? |
|
|
|
 |
Guardian2003
Site Admin

Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Tue Nov 17, 2009 1:16 pm |
|
The most obvious, possible difference that I can think of between the two is the database character set. Are the both using LATIN-1 or ........... |
|
|
|
 |
slackervaara

|
Posted:
Tue Nov 17, 2009 1:21 pm |
|
The database is latin-1 and identical. The database query for the letter Ä worked very well in both cases. I think it must be a php issue and the step prior the database is not working OK. |
|
|
|
 |
Guardian2003

|
Posted:
Tue Nov 17, 2009 3:20 pm |
|
And the actual character can be seen in the page source, not a htmlentity?
Weird. |
|
|
|
 |
slackervaara

|
Posted:
Tue Nov 17, 2009 3:39 pm |
|
Thanks! In the page source it is the actual character Ä and not the htmlentity. |
|
|
|
 |
slackervaara

|
Posted:
Wed Nov 18, 2009 12:16 am |
|
index.php from Ravennuke 2.30 gave also the identical problem on the web hotel.
I have also tested a local site on Mandriva 2010 with PHP 5.3 with identical problems as the web hotel. |
|
|
|
 |
Guardian2003

|
Posted:
Wed Nov 18, 2009 5:08 am |
|
In that case, I don't know the answer. I'm actually building a test site at the moment to use strictly utf-8 in order to research these sorts of problems but it seems to me that the character your using isn't in the latin-1 or iso character set but don't have a clue as to if it's mySQL that has a problem with the character or PHP. |
|
|
|
 |
slackervaara

|
Posted:
Wed Nov 18, 2009 11:28 pm |
|
It seems to be a difficult problem to solve, but your help is highly appreciated. When I click on Ä at the web hotel I can see Ä in the URL all right, but the page with the book starting with Ä does not show up, but instead the index page.
I have tried to use utf8_decode like this:
default:
$letter = utf8_decode($letter);
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
break;
This would have change the letter from utf8 to iso8859, but this does not change anything. It must be letter Ä that is disturbing some how, because normal letters works OK. |
|
|
|
 |
Guardian2003

|
Posted:
Thu Nov 19, 2009 5:09 am |
|
So this character is in a book title.
It would be worth checking to see if the character is seen as it really is or an htmlentity when you look at the page source for that review and also, see what is stored in the DB.
It seems to me that the reason the search fails is because the character doesn't match what is being searched for, so somewhere, there is a mis-match, it just a question of finding it. |
|
|
|
 |
slackervaara

|
Posted:
Fri Nov 20, 2009 12:39 am |
|
I have looked in the database and the characters are correct and Ä. Also if I make the database query it will find the correct book that starts with Ä.
I think it must be a php issue with Ä and possible alternative is $letter or $title in index.php.
On top of index.php I have:
<?php header("Content-Type: text/html; charset=iso-8859-1");
Unfortunately, this did not make any difference. |
|
|
|
 |
slackervaara

|
Posted:
Sat Nov 28, 2009 11:54 pm |
|
I could not get it working, but instead I had to use Reviews Plus module
http://slaytanic.sourceforge.net/modules.php?name=Downloads&cid=4
I have a small problem with this module and the rights block are showing up, despite I have changed in index.php to:
Code:
$index = 0; //Turn Right Blocks On (1) or Off (0) / Bloques Derechos Activos (1) o Inactivos (0); For 7.7 patched 3.1 or earlier version.
define('INDEX_FILE', false); // Turn Right Blocks On (true) or Off (false) / Bloques Derechos Activos (true) o Inactivos (false); For 7.8 Patched 3.1 or newer version
define('IN_RPM', false);
|
|
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sun Nov 29, 2009 8:51 am |
|
slackervaara, comment out the 'define' line. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
slackervaara

|
Posted:
Sun Nov 29, 2009 9:51 am |
|
Many thanks! It worked perfectly! |
|
|
|
 |
montego

|
Posted:
Sun Nov 29, 2009 2:59 pm |
|
|
|
 |
|