Mudsaf Posted May 23, 2012 Share Posted May 23, 2012 Im wondering why i see at my localhost letters like ä and ö, but when i go to my online page it writes like. Is there some config that should be done in php.ini or what? Any suggestions. Charset: charset=iso-8859-1 Ä = Ä Link to comment Share on other sites More sharing options...
boen_robot Posted May 23, 2012 Share Posted May 23, 2012 Use UTF-8... everywhere... encoding, charset... if there's a way to alter it, alter it.This includes file encoding, HTTP header, meta element... if you have database, the connection charset, the db charset, and the table collation.Once you have, and explicitly indicate, UTF-8, all characters should be outputted correctly. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 24, 2012 Author Share Posted May 24, 2012 (edited) Well actually id like to keep it at iso-8859-1. But the main problem was SERVER 1 (Xampp)Shows them like they should be ä, ö ... etc SERVER 2 (PHP not 100% sure)Shows them like Ä = Ä Both has same files and xampp shows correctly. So should i change settings at PHP.ini or somewhere? Edited May 24, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
Ingolme Posted May 24, 2012 Share Posted May 24, 2012 It looks as if, at some point, the data is being converted to UTF-8. Is this data coming from the database? If there isn't a better way to find out where this is happening, you can use PHP's utf8_decode() function. I'd rather find out where the conversion is happening and solve the problem from the root. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 24, 2012 Author Share Posted May 24, 2012 (edited) Yes data is coming at database collation = emptytried collation = utf-8 general ci still no difference. at every page start there is the code below under <head> tag.<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> Edited May 24, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
dsonesuk Posted May 24, 2012 Share Posted May 24, 2012 try<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> Link to comment Share on other sites More sharing options...
Mudsaf Posted May 24, 2012 Author Share Posted May 24, 2012 No effect when changed meta to utf-8. Text isn't htmlspecial coded in database so its like "TÄMÄ" <-- for example whitout quotes. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 24, 2012 Author Share Posted May 24, 2012 (edited) had htmlspecialchars_decode, but removed and ä turned to ? inside <> with reversed vertically. UTF-8 decode just makes ä to ? Kind a fixed, but would still be good if it would automaticly. Turned coding from browser to ISO from utf-8 and now it says Ä & Ö. Edited May 24, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
boen_robot Posted May 24, 2012 Share Posted May 24, 2012 Well actually id like to keep it at iso-8859-1.1. Why?2. If you insist... specify that charset everywhere. Encode your files as "ANSI", use it as a header, meta, db collation, etc.The point is to specify the same thing everywhere, not to mix things. Also, if you use htmlspecialchars(), html_entity_decode() or another similar function, you should specify the charset parameter there to the charset of the input. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 24, 2012 Author Share Posted May 24, 2012 Okay its UTF-8 now on php page, MySQL table = utf-8 general ci. Still no difference data taken from database with SELECT + $row['Column'] not decoded. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 24, 2012 Author Share Posted May 24, 2012 Somehow HTMLENTITIES fixed it. Link to comment Share on other sites More sharing options...
Guest So Called Posted May 24, 2012 Share Posted May 24, 2012 Do you fully understand what HTML character entities are? Link to comment Share on other sites More sharing options...
Mudsaf Posted May 29, 2012 Author Share Posted May 29, 2012 Still having some problems when data comes from MySQL database... if i change page coding to UTF-8 from ANSI navigation goes like crazy, but now textarea is going crazy. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) BBKAWKAKRAWR now textarea is good, but the navigation is fked T_T There must be problem in PHP or MySQL server since xampp shows it now correctly, but other server shows it like mess. Edited May 29, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
dsonesuk Posted May 29, 2012 Share Posted May 29, 2012 Have you tried mb-convert-encoding http://php.net/manual/en/function.mb-convert-encoding.php Link to comment Share on other sites More sharing options...
Mudsaf Posted May 29, 2012 Author Share Posted May 29, 2012 Well the problem isn't at convering since i got 2 servers BOTH has same files >Server 1 = Xampp [Works Like Charm]>Server 2 = PHP Server with MySQL [Problems] Link to comment Share on other sites More sharing options...
Ingolme Posted May 29, 2012 Share Posted May 29, 2012 What exactly are the problems? Are you getting error messages? Link to comment Share on other sites More sharing options...
Mudsaf Posted May 29, 2012 Author Share Posted May 29, 2012 (edited) No errors when display_errors = On Really this is bit confusing T_T, bit fixed when ie settings changed still text = messed at textarea. Hmm $text = mb_convert_encoding($row['Teksti'], 'UTF-8', "ISO-8859-1"); result = ä Looks clear in Xampp server but not in PHP T_T Edited May 29, 2012 by Mudsaf Link to comment Share on other sites More sharing options...
Ingolme Posted May 29, 2012 Share Posted May 29, 2012 This data is being obtained from the database?Be sure that the database has the information stored in the right encoding. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 30, 2012 Share Posted May 30, 2012 If it's working in one server and not in another then you'll need to look for differences. That may mean checking PHP settings, MySQL settings, and checking the headers that the server returns. Link to comment Share on other sites More sharing options...
Mudsaf Posted May 30, 2012 Author Share Posted May 30, 2012 Ill check the MySQL settings after im at work-based learning (Ends tomorrow) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now