Jump to content

Unwanted questionmarks


Reo

Recommended Posts

MySQL server version - Client API version 5.1.59

Description of what it is currently doing that is not to my liking.

 

I have installad an Event Calendar that seems to work properly as long as the English language is used. This calendar is supposed to work with the Swedish language as well, so I have uploaded the Swedish language php file in language directory. This was an option from the developer.

 

So the problem now is that every letter å, ä, and ö is not showing up properly when adding an event, or when visitors leave comments on events. I have worked around the problem by using HTML for those letters while adding an event. But that is not possible when visitors leave comments. Those 3 letters turns up as questionmarks on the page.

 

This is the adress to how it appears:

http://buick.net23.net/calendar/events/index.php?cmd=event&event=3

Link to comment
Share on other sites

What's the default database character set and database collation? Most of mysql visual tools use the default db character set and collation as latin1_swedish_ci, if so you don't have to have any issues with swedish letters.

Link to comment
Share on other sites

I am not sure what column you are refering to.

 

But while browsing the me_settings table there in the browse tab it states under language, swedish.php

 

http://buick.net23.net/calendar/me_settings_browse.jpg

 

While in the structure tab it states in the language row english.php as default.

 

http://buick.net23.net/calendar/me_settings_structure.jpg

Link to comment
Share on other sites

@REO, once you have selected the database via phpMyAdmin, click the 1st icon (browse) under action, beside the table name, while in the structure view and do a "view" to display rows of data in the database containing those swedish letters. I want to know how the swedish letters are represent in this column as question marks or normal swedish letters?

Link to comment
Share on other sites

I understand. It has to be in the table, me_comments at the tab, browse.

 

http://buick.net23.net/calendar/me_comments_browse.jpg

 

I have to add, that the first comment was written without åäö. (on the page).

The 2nd and 3rd was written exactly the same way as

Testkommentar2åäöÅÄÖ

Testkommentar3åäöÅÄÖ

 

The difference is that in one case I used the charset iso-8859-1 in the Swedish language php file

in the other I used utf-8. Neither of them seemed to solve anything.

Link to comment
Share on other sites

No. According to the above picture, the 2nd row is being created by proper encoding, the 3rd NOT. You don't have to use utf-8 as character encoding when inserting a data to database. Have you added a charset to the php connection string, such as charset=utf8?

Link to comment
Share on other sites

I've made a test using the same database character set and collation (latin1_swedish_ci) setting apache headers in the html document as <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> and works just fine with this charset. Are you using in your php code a header() function somewhere?

Edited by jazzman1
Link to comment
Share on other sites

If I have added a charset to the php connection string, such as charset utf-8.

Thats the only thing I did, I changed in the swedish language php file charset to utf-8 .And it gave me some signs at the page that I not am able to reprint.

Before I changed it, it said iso-8859-1 and that gave me ????? on the page.

 

If I am using in my php code a header function somewhere. I have not really opened up the other php pages to find out what's in there. I downloaded the hole set for free from http://www.maianevents.com the language file was a separate download from the same site.

Link to comment
Share on other sites

Hm....it's a template. How did you create the database and all tables by this application (event calendar) or via phpMyAdmin?

 

To fix it open up the index.php file (located in the main directory) and change the following:

// Collation..
@mysql_query("SET CHARACTER SET 'utf8'");
@mysql_query("SET NAMES 'utf8'");

//to 

// Collation..
mysql_query("SET CHARACTER SET 'latin1'");
mysql_query("SET NAMES 'latin1'");
Edited by jazzman1
Link to comment
Share on other sites

How I created the database and all tables.

 

Well, first of all I created an emty database, by using the instructions that was at hand in the webshell.

Then I used the autoloader that came with the Event Calender. That's about it.

 

Just out of curiosity, what  difference does it make if the Collation strings in index.php begins with @mysql...... instead of mysql_query?

Link to comment
Share on other sites

 

Just out of curiosity, what  difference does it make if the Collation strings in index.php begins with @mysql...... instead of mysql_query?

 

The "at" (@) symbol is called error-control operator in PHP. It suppress errors, warnings and notices, so, I recommend to avoid using it when you're developing applications and for sure there is nothing to do with charset and collation settings in this case. I saw you fixed the problem changing "utf8" to "latin1".  

Link to comment
Share on other sites

Yes, now everthing seems to work as intended. I kept the @ symbol because I figured it had to be there for some reason (even if it was unknown at the time). Well, thank you for your time helping me out. I might post again, if I get in trouble.

Link to comment
Share on other sites

I recently discovered another issue. There is an oportunity for visitors to e-mail a question to an e-mail adress that is setup within the login admin interface of the Event Calendar. One mail goes to the admin and one to the sender, saying an answer to your question will be sent as soon as possible.

 

Here we have the same story again, but this time the letters in the e-mails that are received appear as square cubes.

 

http://buick.net23.net/calendar/mail.png

Link to comment
Share on other sites

By default this app uses the phpMailer library whose default charset is set to iso-8859-1, but apache headers are being set to utf-8, don't ask me why :confused:

 

So, find the file named class_mail.inc.php, the full path is - /maian_events/events/classes/class_mail.inc.php and change the charset inside mailHeaders() function from utf-8 to iso-8859-1.

 

The function,

// Mail headers..
function mailHeaders($name,$email)
{
  if ($this->html) {
    $headers  = "Content-type: text/html; charset=utf-8\r\n";
    $headers .= "From: \"".$this->injectionCleaner($name)."\" <".$email.">\n";
  } else {
    $headers  = "Content-type: text/plain; charset=utf-8\r\n";
    $headers .= "From: \"".$this->injectionCleaner($name)."\" <".$email.">\n";
  }

  $headers .= "X-Sender: \"".$this->injectionCleaner($name)."\" <".$email.">\n";
  $headers .= "X-Mailer: PHP\n";
  $headers .= "X-Priority: 3\n";
  $headers .= "X-Sender-IP: ".$_SERVER['REMOTE_ADDR']."\n";
  $headers .= "Return-Path: \"".$this->injectionCleaner($name)."\" <".$email.">\n";
  $headers .= "Reply-To: \"".$this->injectionCleaner($name)."\" <".$email.">\n";

  return $headers;
}
Link to comment
Share on other sites

Yes, that took care of the problem. Thanks.

 

Still there is one thing that puzzles me. In this case the sender of the mail (visitor at the page) has an Hotmail account and everything seemes fine. The administrator uses the applicaton Windows Live Mail that connects to a server at Bahnhof, for receiving the messages sent. However, the thing is that the Subject in the mail received excludes the letter åäö. Everyting else inside, when the e-mail is opened is OK.

 

My question is, could this be something at Bahnhof that causes this to happen or is it something in the Maian Event.

 

http://buick.net23.net/calendar/bahnhof.png

Link to comment
Share on other sites

It seems that we have reached the the end of the line here, quite a cumbersome journey, we are well in to the second page now.

 

The line in the Swedish language php file that misbehaves in the mail client is:

 

$contact19       = 'Fråga Om Evenemang';

 

I figured that if I change the word Fråga to something similar like Fundering, the problem never occurs, and no one will be the wiser. I Think that will have to do it for now. Thanks. 

Edited by Reo
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.