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. 2 2653
In article <4c**************************@posting.google.com >, one of infinite monkeys
at the keyboard of er**@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
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.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Erik Neves |
last post by:
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...
|
by: Stuart Gerchick |
last post by:
When will PHP properly support UNICODE
|
by: pbuchheit |
last post by:
I need to convert Japanese characters to UTF-8. I tried using this
command on a PHP 5.0.3 server:
$out = iconv("iso-2022-jp", "utf-8", $in);
But it does not work. Can anyone tell me what I'm doing...
|
by: gabor |
last post by:
hi,
today i made some tests...
i tested some unicode symbols, that are above the 16bit limit
(gothic:http://www.unicode.org/charts/PDF/U10330.pdf)
..
i played around with iconv and so on,...
|
by: Dumbkiwi |
last post by:
I'm trying to get python, unicode and kdialog to play nicely together.
This is a linux machine, and kdialog is a way to generate dialog boxes in
kde with which users can interact (for example input...
|
by: Spamtrap |
last post by:
I only work in Perl occasionaly, and have been searching for a
solution for a conversion, and everything I found seems much too
complex.
All I need to do is take a simple text file and copy...
|
by: Keith MacDonald |
last post by:
Hello,
Is there a portable (at least for VC.Net and g++) method to convert text
between
wchar_t and char, using the standard library? I may have missed something
obvious, but the section on...
|
by: Tony Nelson |
last post by:
Is there a faster way to decode from charmaps to utf-8 than unicode()?
I'm writing a small card-file program. As a test, I use a 53 MB MBox
file, in mac-roman encoding. My program reads and...
|
by: David Lutz |
last post by:
Hello, I want to convert an existing database with
SQL_ASCII encoding to UNICODE encoding.
(postgresql ver 7.3.2)
I thought that it might be as easy as:
pg_dump mydatabase > dump.sql...
|
by: Aneesh E Warrier |
last post by:
How can I convert Unicode Codepoint (dec) value to ASCII char?
For example: 49324 is 사 a Korean alphabet, and I want to convert it
to ASCII letter.
Thanks!
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |