From: "Parham Doustdar" on 24 Apr 2010 10:26 Hi again, That did work, indeed. Now, I guess that means that Apache is outputting the PHP as something other than UTF-8. In fact, googling, I came up with this line of .htaccess: AddDefaultCharset UTF-8 which works perfectly! Thank you, everyone, for yet again helping me out. "Ashley Sheridan" <ash(a)ashleysheridan.co.uk> wrote in message news:1272117941.20937.164.camel(a)localhost... > On Sat, 2010-04-24 at 18:37 +0430, Parham Doustdar wrote: > >> Hi Ashley and Michiel, >> >> It appears it is something in Apache or my server program on Windows (I >> am >> using Uniform Server; a portable webserver from >> http://www.uniformserver.com). The reason I got to such a conclusion is >> this: >> >> 1. I uploaded the pHP file to a free hosting website. Here is the URL: >> http://blindmoviebuff.uphero.com/test2.php >> >> 2. I put the same page in my www folder in Windows. Here's the address to >> that: >> http://parham-d.dyndns.org/test2.php >> >> As you can see, the page on uphero.com displays without any encoding >> changes >> required by you, whereas the second has to be manual (for some reason). I >> thought seeing the UTF-8 made the browser use that encoding automatically >> regardless of whether or not it was sent in UTF-8? >> >> Sorry, I have no information at all about how transmiting is handled. >> Just >> saying guesses aloud. :-) >> ----- Original Message ----- >> From: "Ashley Sheridan" <ash(a)ashleysheridan.co.uk> >> Newsgroups: php.general >> To: "Michiel Sikma" <michiel(a)thingmajig.org> >> Cc: "Parham Doustdar" <parham90(a)gmail.com>; <php-general(a)lists.php.net> >> Sent: Saturday, April 24, 2010 6:16 PM >> Subject: Re: [PHP] Question: Farsi characters showing as jibberish >> >> >> > On Sat, 2010-04-24 at 15:38 +0200, Michiel Sikma wrote: >> > >> >> On 24 April 2010 14:45, Parham Doustdar <parham90(a)gmail.com> wrote: >> >> >> >> > Hi, >> >> > >> >> > I have created a PHP file, and wrote a string of Farsi letters in >> >> > it. >> >> > In >> >> > the >> >> > head section of the HTML, I put: >> >> > >> >> > <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> >> >> > >> >> > There appears to be something wrong with Apache, or something, >> >> > because >> >> > no >> >> > matter whether I put that string in an echo statement or just in an >> >> > HTML >> >> > with a php extention, the page loads as jibberish and I have to set >> >> > the >> >> > character encoding to UTF-8 manually in Firefox. >> >> > >> >> > Renaming that same file to .htm (when not using the echo statement), >> >> > and >> >> > loading it in the browser shows me the correct Farsi characters. >> >> > >> >> > Should I change something in Apache's settings for this to work? >> >> > >> >> > Thanks! >> >> > >> >> > >> >> > No, that should work perfectly fine. Are you sure that the PHP file >> >> > itself >> >> is utf-8? >> >> Could it be that you manually set the text encoding to something else >> >> in >> >> your browser, causing it to remember that setting? >> >> >> >> Perhaps you could link us to the page itself so we can have a look. >> >> Note >> >> that the best place to put that <meta> tag is right after the opening >> >> <head> >> >> tag, before any other header information. >> >> >> >> Michiel >> > >> > >> > If renaming the file as .htm shows the characters correctly, then >> > the .php file is most likely saved as utf8. >> > >> > Maybe Apache has been instructed to send all HTML with another >> > encoding, >> > as it should send it out with the same encoding as the requested PHP >> > script. >> > >> > Thanks, >> > Ash >> > http://www.ashleysheridan.co.uk >> > >> > >> > >> >> >> > > Try adding this before any output to the browser: > > header('Content-Type: text/html; charset=utf-8'); > > Which should force the server to send the output in this specific > format. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > >
From: Michiel Sikma on 24 Apr 2010 10:26 On 24 April 2010 16:07, Parham Doustdar <parham90(a)gmail.com> wrote: > Hi Ashley and Michiel, > > It appears it is something in Apache or my server program on Windows (I am > using Uniform Server; a portable webserver from > http://www.uniformserver.com). The reason I got to such a conclusion is > this: > > 1. I uploaded the pHP file to a free hosting website. Here is the URL: > http://blindmoviebuff.uphero.com/test2.php > > 2. I put the same page in my www folder in Windows. Here's the address to > that: > http://parham-d.dyndns.org/test2.php > > As you can see, the page on uphero.com displays without any encoding > changes > required by you, whereas the second has to be manual (for some reason). -snip- > > Actually, both of these work fine for me. I don't have to manually set the encoding to get the Farsi characters to show up in either of these links. I don't know why it wouldn't work for you. Maybe you should try a different browser to make sure it isn't a cached setting. Adding the header() call that Ashley suggested also seems like a good idea. Michiel
From: "Parham Doustdar" on 24 Apr 2010 10:34
Hi, It probably did because I added the line, AddDefaultCharset UTF-8 to my .htaccess a few moments ago. :-) "Michiel Sikma" <michiel(a)thingmajig.org> wrote in message news:o2p6cda1ded1004240726l272f04fbmdd2fb996e2580ea5(a)mail.gmail.com... > On 24 April 2010 16:07, Parham Doustdar <parham90(a)gmail.com> wrote: > >> Hi Ashley and Michiel, >> >> It appears it is something in Apache or my server program on Windows (I >> am >> using Uniform Server; a portable webserver from >> http://www.uniformserver.com). The reason I got to such a conclusion is >> this: >> >> 1. I uploaded the pHP file to a free hosting website. Here is the URL: >> http://blindmoviebuff.uphero.com/test2.php >> >> 2. I put the same page in my www folder in Windows. Here's the address to >> that: >> http://parham-d.dyndns.org/test2.php >> >> As you can see, the page on uphero.com displays without any encoding >> changes >> required by you, whereas the second has to be manual (for some reason). > > -snip- >> >> > > Actually, both of these work fine for me. I don't have to manually set the > encoding to get the Farsi characters to show up in either of these links. > I don't know why it wouldn't work for you. Maybe you should try a > different > browser to make sure it isn't a cached setting. Adding the header() call > that Ashley suggested also seems like a good idea. > > Michiel > |