ckrudelux Posted August 17, 2009 Share Posted August 17, 2009 My iso-8859-1 letters like "ÅÄÖ" has changed to symbol with a "?" in it I think it has to do with my js code adding my php file.any easy solution to this or do I have to change every letter to the code version? Link to comment Share on other sites More sharing options...
Ingolme Posted August 17, 2009 Share Posted August 17, 2009 Have you specified an encoding for your page?The best way is PHP: <?php header("Content-Type: text/html;charset=ISO-8859-1"); ?> If you can't use PHP, use a <meta> tag: <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> Link to comment Share on other sites More sharing options...
ckrudelux Posted August 18, 2009 Author Share Posted August 18, 2009 Have you specified an encoding for your page?The best way is PHP:<?php header("Content-Type: text/html;charset=ISO-8859-1"); ?> If you can't use PHP, use a <meta> tag: <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> This what I have that I though would cover it but the javascript seems to ignore or something.<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1" /> Link to comment Share on other sites More sharing options...
Ingolme Posted August 18, 2009 Share Posted August 18, 2009 This what I have that I though would cover it but the javascript seems to ignore or something.<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1" /> Are you receiving anything through HTTP requests in Javascript? Link to comment Share on other sites More sharing options...
ckrudelux Posted August 18, 2009 Author Share Posted August 18, 2009 Are you receiving anything through HTTP requests in Javascript?Errors no. I get the data needed but every letter what is "Ö" or "Ä" and "Å" is geting replaced by a question mark. Link to comment Share on other sites More sharing options...
Ingolme Posted August 18, 2009 Share Posted August 18, 2009 Errors no. I get the data needed but every letter what is "Ö" or "Ä" and "Å" is geting replaced by a question mark.Where is the data coming from? Information received through AJAX requests is usually encoded in UTF-8. Though your problem seems to be something different. Link to comment Share on other sites More sharing options...
ckrudelux Posted August 18, 2009 Author Share Posted August 18, 2009 Where is the data coming from? Information received through AJAX requests is usually encoded in UTF-8. Though your problem seems to be something different.Well how do I change the encoding couse what I think is the problem I just didn't know that it had one there seens you set the encoding at the head. Link to comment Share on other sites More sharing options...
Ingolme Posted August 18, 2009 Share Posted August 18, 2009 If you're requesting information from a PHP file with AJAX, send a Content-type header before the rest of the information. <?php header("Content-Type: text/html;charset=ISO-8859-1"); ?> Link to comment Share on other sites More sharing options...
dsonesuk Posted August 18, 2009 Share Posted August 18, 2009 try this - This checks to see if the browser accepts the application/xhtml+xml MIME type and if it does, that MIME type is sent and the XHTML1.1 document type is written to the HTML. If the MIME type isn't recognised then the text/html MIME type is sent and the XHTML1.0 Strict document type is written in the HTML.<?if(stristr(\$_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")){ header("Content-Type: application/xhtml+xml; charset=iso-8859-1"); echo('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">');} else { header("Content-Type: text/html; charset=iso-8859-1"); echo ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');}?> as a matter of interest if the above does not work, see what happens when you use <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />i'm sure someone had a similar problem and using this helped correct it. Link to comment Share on other sites More sharing options...
ckrudelux Posted August 18, 2009 Author Share Posted August 18, 2009 If you're requesting information from a PHP file with AJAX, send a Content-type header before the rest of the information.<?php header("Content-Type: text/html;charset=ISO-8859-1"); ?> Then adding header("Content-Type: text/html;charset=ISO-8859-1"); to my php file everything worked fine Thanks alot. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.