![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I need help with utf-8 before i go bald and the rest of my hair turns white! Platform: Mac OS X 10.2.6 Safari 1.0 (v85) Internet Explorer:mac 5.2.3 (5815.1) Apache 2.0.47 PHP 4.3.2 (Apache 2 module) libiconv 1.8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Unicode Test</title> </head> <body><p> <?php $macRom = 'métallique arquée'; // typed in a bbedit for mac echo iconv('MacRoman', 'UTF-8', $macRom); ?> </p></body></html> When I run this script, I get, both in Safari and Explorer, métallique arquée and not métallique arquée But, that's why I'm going crazy, *if* I save this output as an html file and load it in Safari, *it shows the proper accents*! Now, can somebody please explain me why a page generated using PHP is behaving differently from the very same output of that page? What am I missing? Thank you all. | |||
| Advertisements |
| | #2 | ||
| In article <4ce7d0c9.0308271637.1b08d67c@posting.google.com>, one of infinite monkeys at the keyboard of erik@tba.com.br (Erik Neves) wrote: > behaving differently from the very same output of that page? What am I > missing? At a guess, maybe your server is setting a different charset. Last time I looked, Apache defaults to iso-8859-1 unless you tell it to do otherwise. -- Nick Kew In urgent need of paying work - see http://www.webthing.com/~nick/cv.html | |||
| | #3 | ||
| On Thu, Aug 28, Erik Neves inscribed on the eternal scroll: > Please disregard this post. I could resist that invitation ;-) > I alredy found the answer. You already found _an_ answer, it seems. And a good one, in practical terms, but it still leaves some details unclear. > FWIMC, I just added a > > header('Content-Type: text/html; charset=utf-8'); > > before any content and everything worked just fine. It should do... > It seems that the > tag > <meta http-equiv="content-type" content="text/html; charset=utf-8" /> > is not enough. Which is exactly what Appendix C to XHTML/1.0 says: it is not enough. Even with HTML, there is an issue: if the server is configured to send a different charset than what you put into META, then what the server sent is specified to take priority. So you need to keep control of your server anyway, and the W3C recommend (rightly so, in my opinion) to use the server's real HTTP header on the transaction, in preference to using (or trying to use) meta stashed inside the document. But in XHTML (which is what you're evidently aiming at), "meta" comes too late, and means nothing (to XHTML). You'd only put it there (if you use it at all) in XHTML/1.0, for the reason of compatibility with older browsers (and other user agents), but for XHTML you'd need to conform with XML's rules also, as set out in Appendix C. And here again, life is simplest if you use the real HTTP content-type header to specify your character encoding (that so-called "charset" parameter). > Now I can have a site with a Russian interface and Japanese contents, > just for the fun of it! Thanks to Unicode. And some right-to-left scripts for a dessert. ;-) cheers (f'ups narrowed - this isn't a specifically PHP issue.) | |||
| Featured Websites | ||||
|
![]() |
| Tags: doesnt, generated, iconv, php, properly, show, unicode |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can you properly integrate PHP and Perl? | Sarah E. Green | PHP | 1 | 07-01-2007 4:20 PM |
| PLEASE HELP! GARMIN GPSMAP 196 Update and now my maps fail to show properly! | Shane | GPS | 4 | 06-25-2007 11:19 PM |
| How to secure a head unit properly? | Dan | Car audio | 1 | 06-17-2007 3:06 PM |
| SEO for dynamically generated product catalogue | Graeme | Database | 2 | 05-31-2007 8:49 PM |
| iconv to strip out specfic language characters | kkadrese@yahoo.com | PHP | 0 | 05-20-2007 6:33 PM |
| Featured Websites | ||||
|