Hi,
I've a pb with utf8 encoding with safari or firefox.
I retrieve the response of a XMLHttpRequest and depending if I use
safari or firefox I can't manage to get characters like "éàç"
to see an illustration you can try the code below :
(with this code I get a "é" with firefox but not with safari. I need to
add a ut8_decode to get the "é"!)
RQ : the files are encoded in utf8
thank you
// index.php :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled </title>
</head>
<body>
<script type="text/javascript" charset="utf-8">
function search() {
var xmlHttp;
if (window.ActiveX Object) xmlHttp = new
ActiveXObject(" Microsoft.XMLHT TP");
else if (window.XMLHttp Request) xmlHttp = new XMLHttpRequest( );
else { alert('JavaScri pt error : problem with
XMLHttpRequest objects ...'); return;}
var url = "action.php ";
xmlHttp.open("G ET", url, false);
xmlHttp.send(nu ll);
if (xmlHttp.readyS tate == 4) { print(xmlHttp.r esponseText) }
}
function print (response) {
alert(response) ;
}
search();
</script>
</body>
</html>
-----------------------------------------------------
// action.php
<?php
echo "é";
// or
//echo ut8_decode("é") ;
?> 4 2775
*** twigster escribió/wrote (Mon, 21 Aug 2006 23:42:33 +0200):
// action.php
<?php
echo "é";
// or
//echo ut8_decode("é") ;
?>
I don't know if browsers obey HTTP headers under this situation, but it's
always good practice to make sure you have a correct Content-Type header.
If web server doesn't generate the correct one, do it yourself:
<?php
header('Content-Type: text/html; charset=UTF-8');
echo "é";
?>
.... given than you save the file as UTF-8 (all good editors allow you to
choose).
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
I still get "é" rather than "é" in my alert in safari... :(
even with
// action.php
<?php
header('Content-Type: text/html; charset=UTF-8');
echo "é";
?>
twigster wrote:
I still get "é" rather than "é" in my alert in safari... :(
even with
// action.php
<?php
header('Content-Type: text/html; charset=UTF-8');
echo "é";
?>
I'ld say that the output stream should be correct when it shows 'é';
I think it's rather the browser that doesn't know how to represent the
offered data. A route from 'é' to 'é' uses a UTF-8 code table for
sure; since it corresponds to hex C3 ('Ã') plus hex A9 ('©'),
together forming Unicode's "LATIN SMALL LETTER E WITH ACUTE" ('é' or
hex E9 in "traditiona l" sets).
More info, search for 'C3A9' on: http://home.tiscali.nl/t876506/utf8tbl.html
For the basic values, see table on http://en.wikipedia.org/wiki/ISO_8859-1
Did you save action.php in UTF-8 mode ?
I'ld suggest to add meta-information in your page header as well:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
--
Bart
Bart Van der Donck wrote:
I'ld say that the output stream should be correct when it shows 'é';
I think it's rather the browser that doesn't know how to represent the
offered data. A route from 'é§*to 'é' uses a UTF-8 code table for
sure; since it corresponds to hex C3 ('ç) plus hex A9 ('?'),
together forming Unicode's "LATIN SMALL LETTER E WITH ACUTE" ('é§*or
hex E9 in "traditiona l" sets). [...]
It appears that at least Google Groups doesn't show these chars as they
were intended (which indicates again how messy character encoding in
browsers can be).
My post in GIF format: http://www.dotinternet.be/temp/code.gif
--
Bart This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christine Forber |
last post by:
How can you make a div visible and hidden in safari?
document.all.style.display = "none";
Does not appear to work.
Also, can anyone tell me how to turn on javascript error commenting in
Safari? Right now, if javascript fails or errors, the browser just sits
there and doesn't return any error message.
|
by: Bill Cohagan |
last post by:
I'm having some serious difficulties with my ASP.Net 2.0 app rendering in
Safari 2.0.3. The most immediate problem is that the menu control doesn't
seem to work at all, particularly the use of dynamic levels.
I've Googled around a bit and determined that the problem is not so much
with Safari as it is with ASP.Net inaccurately determining the browser
capabilites for that browser. In the 2.0 Framework it appears that browser
caps are...
|
by: Simon Wigzell |
last post by:
document...focus() will scroll the form to move the
specified text field into view on everything I have tried it with except
Safari on the MAC. The form doesn't move. Any work around? Thanks.
|
by: Jeff Paffett |
last post by:
I'm trying to use the onPaste event in a text input, which according to
Apple is supported. However, I get no response in Safari. Firefox works
fine.
|
by: Dayo |
last post by:
Hello folks.
Sorry if this seems a bit silly, I have no experience with this type of code.
Here is a fading script for an Image Gallery I am looking to fix. It works with IE and Safari but not with Firefox and Netscape. Actually, when I say it doesn't work, I mean you have to refresh the page before the fade happens and once that is done once, it works on that image. for that session.
Here is the code:
// Fade In Script
| |
by: weheh |
last post by:
Dear web gods:
After much, much, much struggle with unicode, many an hour reading all the
examples online, coding them, testing them, ripping them apart and putting
them back together, I am humbled. Therefore, I humble myself before you to
seek guidance on a simple python unicode cgi-bin scripting problem.
My problem is more complex than this, but how about I boil down one sticking
point for starters. I have a file with a Spanish word...
|
by: raknin |
last post by:
I am creating a dynamic list on the server using php file,when I run the PHP script in all 4 browsers (IE 6, Firefox 2, opera and safari 3) every think go Ok and the list is created. but when I call the php script from the browser using Ajax, the list is created fine in IE and Opera but on Firefox and safari I got the following error:
"Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in...
|
by: Brad |
last post by:
I have an aspx page that is sending pdf files to client browsers: it uses a filestream to read the pdf file and
response.binarywrite to send content to the browser. This has worked great for years in IE, Firefox and Opera on
windows, and it works on a Mac with Firefox and Opera. But this fails in Safari with the generic message "A network
error occurred while accessing this document".
Here is a link to try out ...
|
by: GinnTech |
last post by:
I have a site that works perfectly in IE6 IE7 FF2 FF3 but not in the
latest Safari.
Here is the issue. I am attempting to call functions within a flash
object. When trying to attempt to retrieve the object to call the
functions IE6 IE7 FF2 FF3 all return Objects to work with. In Safari
a function is returned. Here is the code.
/
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |