Jump to content

[Solved] How a utf8 encoded php file work?


ccc

Recommended Posts

I have a utf8 encoded "php" file on http://agamanikaya.heliohost.org/p.php which is shown the words uncorrectly by "?". While if I save it as a "htm" file encoded the same utf8, the words are shown correctly as on http://agamanikaya.heliohost.org/index.htm, but, of course, it does not work the "php" portion.

Would you please to help me fix this problem: let a utf8 encoded "php" file work to show their words correctly?

Link to comment
Share on other sites

You had some weird whitespace character (U+FEFF) at the start. I removed that, and it looks fine now.

 

Where is the "weird whitespace character (U+FEFF) at the start" ( I mean which line ) you deleted?

The same trouble on http://agamanikaya.heliohost.org/a.php , even I copy from http://agamanikaya.heliohost.org/p.php for the 1-9 lines.

Woukd you please to let me know to do by myslef?

Because I have a lot of such kind of php files(encoding by utf8 and work normal on other web) want to work here.

Thank you so much!

 

Link to comment
Share on other sites

I'm really unsure at this point. Is the PHP file encoded in UTF-8?

 

Yes, it is.

How did yo make it?

I still have php files running abnormal here whle normal on other web.

 

Would it be the setting problem on the server?

 

The followings was quoted from

http://www.w3.org/International/questions/...encoding#server

 

Step 3: Ensure that your server does the right thing

Although your data is in UTF-8 and you have declared it in the page, your server may still be serving the page with an accompanying HTTP header that says it is something else. The declaration in the HTTP header will override information inside the page.

 

To address this you need to check whether this is actually a problem or not, and then, if it is, take steps to rectify it.

 

Server admin privileges are needed to change the encoding sent in the HTTP header, though you may be able to do so yourself even if you are serving files via an ISP. Consult your server admin person. See the explanation of one way to do this for an Apache server.

Link to comment
Share on other sites

The cpanel file manager gives you the option to use different encodings including UTF-8 when you first create a page and start to edit it. Have you tried that? I think this option can be overidden in Settings at the top of the file manager page.

 

 

 

Link to comment
Share on other sites

The cpanel file manager gives you the option to use different encodings including UTF-8 when you first create a page and start to edit it. Have you tried that? I think this option can be overidden in Settings at the top of the file manager page.

 

i did it.

i uploaded a.php again and enter to cpane/file manager/code editer.

it shows this file code is utf-8.

i saved it again using cpane/file manager/code editer/save changes.

but now http://agamanikaya.heliohost.org/a.php still shows abnormally.

Link to comment
Share on other sites

When you go inside your edit page, does it show the correct characters or is it showing abnormally too? If it's showing abnormally then it got saved that way and you need to re-edit the page.

 

 

 

Edit:

 

Here's your problem. Remove this right before the <html> tag 

 

from this:

<html>

 

to this:

 

<html>

 

http://byrondallas.heliohost.org/test/test-index.php

 

 

Link to comment
Share on other sites

Here's your problem. Remove this right before the <html> tag 

 

from this:

<html>

 

i enter cpane/file manager/code editer to check a.php.

and there is no "<html>" as you mentioned, only "<html>".

it also show the correct characters.

i saved it. but still shows abnormally.

 

my computer is window xp, traditional chinese (big5) version.

 

by the way, a.php runs normally on other web.

Link to comment
Share on other sites

Your showing those characters on this page that I uploaded:

 

Look in the upper lefthand corner:

http://agamanikaya.heliohost.org/index.htm

 

When I uploaded that page and renamed it with a .php extension it showed abnormally untill I deleted those characters. Then it was ok.

 

http://byrondallas.heliohost.org/test/test-index.php

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...