Computer Webmaster Gaming Console Graphics Forum

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.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

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.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 5:27 PM   #1
Erik Neves
 
Erik Neves's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Unicode generated by php [iconv()] doesn't show properly

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.
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-01-2007, 5:28 PM   #2
Nick Kew
 
Nick Kew's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Unicode generated by php [iconv()] doesn't show properly

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
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:28 PM   #3
Alan J. Flavell
 
Alan J. Flavell's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Unicode generated by php [iconv()] doesn't show properly

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.)
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , , , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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




All times are GMT +1. The time now is 7:31 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98