Reo Posted March 23, 2014 Share Posted March 23, 2014 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 Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted March 23, 2014 Share Posted March 23, 2014 (edited) as a starting point, you need to set the character encoding on your web page to be UTF-8 (it is currently windows-1252 as reported by my browser's info page, you are setting in the page to charset=iso-8859-1) Edited March 23, 2014 by mac_gyver Quote Link to comment Share on other sites More sharing options...
Reo Posted March 23, 2014 Author Share Posted March 23, 2014 All right. So now I have changed the Swedish language php file from: $charset = 'iso-8859-1'; to $charset = 'utf-8'; Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 24, 2014 Share Posted March 24, 2014 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. Quote Link to comment Share on other sites More sharing options...
Reo Posted March 24, 2014 Author Share Posted March 24, 2014 This is the second time I visit phpMyAdmin so I am not familiar with the proceedings. I took some snapshots so it is possible to see how things are setup. http://buick.net23.net/calendar/interface.jpg At the moment I could not find the default database character set, but there was a window for the collation. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 24, 2014 Share Posted March 24, 2014 Then, most likely you're using different charset settings when you're inserting the data to database. Have you seen the content correctly when you try to open the content of this column via phpMyAdmin? Quote Link to comment Share on other sites More sharing options...
Reo Posted March 24, 2014 Author Share Posted March 24, 2014 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 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 24, 2014 Share Posted March 24, 2014 @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? Quote Link to comment Share on other sites More sharing options...
Reo Posted March 25, 2014 Author Share Posted March 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 25, 2014 Share Posted March 25, 2014 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? Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 25, 2014 Share Posted March 25, 2014 (edited) 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 March 25, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
Reo Posted March 25, 2014 Author Share Posted March 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 25, 2014 Share Posted March 25, 2014 (edited) 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 March 25, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
Reo Posted March 25, 2014 Author Share Posted March 25, 2014 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? Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 27, 2014 Share Posted March 27, 2014 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". Quote Link to comment Share on other sites More sharing options...
Reo Posted March 27, 2014 Author Share Posted March 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
Reo Posted March 30, 2014 Author Share Posted March 30, 2014 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 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 31, 2014 Share Posted March 31, 2014 Show us the html form and php script with the mail() function. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 31, 2014 Share Posted March 31, 2014 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 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; } Quote Link to comment Share on other sites More sharing options...
Reo Posted March 31, 2014 Author Share Posted March 31, 2014 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 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted March 31, 2014 Share Posted March 31, 2014 Send me email at tuparov86@gmail.com, to check the mail headers. Quote Link to comment Share on other sites More sharing options...
Reo Posted April 2, 2014 Author Share Posted April 2, 2014 I have sent you an email, and this is what I noticed while doing that. http://buick.net23.net/calendar/mystery.png Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted April 2, 2014 Share Posted April 2, 2014 What is the default encoding of this application ( windows live mail ) being set? Quote Link to comment Share on other sites More sharing options...
Reo Posted April 2, 2014 Author Share Posted April 2, 2014 To the best of my knowledge it is Western Europe (ISO). Quote Link to comment Share on other sites More sharing options...
Reo Posted April 3, 2014 Author Share Posted April 3, 2014 (edited) 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 April 3, 2014 by Reo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.