The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HTML Letter Error, HTMl Letter Error
Needler
post Aug 9 2011, 11:23 PM
Post #1





Group: Members
Posts: 3
Joined: 9-August 11
Member No.: 15,137



Hello All,

My name is Josh, I have a question about some simple HTML that I would like to receive some help with.

------

Me and a friend run a Counter-strike hosting company, and we have created the following HTML code, however there is a error, and I cannot figure out the problem.

If you look at the address below,
Click Here

You can see that on the third line down, there is a table, set with the server name.

The server name is

cZ┬╗ Sparta

I don't know the error, but the server name should actually be,

cZ╗ Sparta

Somehow a random "A" letter is inserted. How might I fix this?

I would appreciate any help. Thx.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Aug 10 2011, 12:13 AM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,316
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



The file appears to use UTF-8 character encoding, but your server is sending it as

Content-Type: text/html

rather than as

Content-Type: text/html; charset=UTF-8

so the browser has to guess what character encoding to use.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Aug 10 2011, 12:16 AM
Post #3


Jocular coder
********

Group: Members
Posts: 2,298
Joined: 31-August 06
Member No.: 43



It isn't a proper html document, since it starts "<table border="1"><tr><td>IP</td><td>184.154.138.58</td></tr><tr><td>Port</td><td>36965</td></tr><tr><td>Name</td><td>cZ╗ Sparta..."

Your program needs to output the rest of the document, starting with doctype, including <html>, <head>, <body>, etc.

In the html document you should specify what encoding you are using; the character problem is almost certainly a confusion of encodings. We can't find the problem (if there is one) in the php program without seeing it...

HTH
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Needler
post Aug 10 2011, 06:21 PM
Post #4





Group: Members
Posts: 3
Joined: 9-August 11
Member No.: 15,137



So, I need to Format and include <html>, <head>, <body>, etc.


And how might I change it from Content-Type: text/html

to


Content-Type: text/html; charset=UTF-8

This post has been edited by Needler: Aug 10 2011, 06:43 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Aug 10 2011, 06:35 PM
Post #5


WDG Member
********

Group: Root Admin
Posts: 8,316
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



You don't add the charset in your HTML. You add it by configuring the server. The details vary depending on the server, but could be as easy as adding the line
CODE
AddDefaultCharset utf-8
to your .htaccess file (assuming you're using Apache).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Needler
post Aug 10 2011, 09:33 PM
Post #6





Group: Members
Posts: 3
Joined: 9-August 11
Member No.: 15,137



Okay, so I have added the charset to the .htaccess file, rebooted the server, restarted Apache and nothing seems to have changed. Is there any other way i could fix this? or Is it just my bad luck.

dry.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Aug 11 2011, 12:47 AM
Post #7


WDG Member
********

Group: Root Admin
Posts: 8,316
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



The charset (or lack thereof) hasn't changed:
CODE
$ lynx -dump -head 'http://184.154.138.58/test3.php?ip=184.154.138.58&port=36965'
HTTP/1.1 200 OK
Date: Thu, 11 Aug 2011 00:50:02 GMT
Server: Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze3 with Suhosin-Patch
X-Powered-By: PHP/5.3.3-7+squeeze3
Vary: Accept-Encoding
Connection: close
Content-Type: text/html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Aug 11 2011, 03:05 AM
Post #8


Jocular coder
********

Group: Members
Posts: 2,298
Joined: 31-August 06
Member No.: 43



QUOTE(Needler @ Aug 11 2011, 11:33 AM) *

Okay, so I have added the charset to the .htaccess file, rebooted the server, restarted Apache and nothing seems to have changed. Is there any other way i could fix this? or Is it just my bad luck.

dry.gif


Well, if you make the php program output a proper html file (almost all of this will just be a constant string at the beginning and end), then you can at least output a meta tag with the content type. In practice this will tell browsers which character set to us. (As I recall, the original html specification is incoherent hereabouts.)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Aug 11 2011, 12:04 PM
Post #9


WDG Member
********

Group: Root Admin
Posts: 8,316
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Oops... I forgot about PHP. The PHP file will need to include the following at the beginning:
CODE
header( 'Content-type: text/html; charset=utf-8' );
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 15th November 2019 - 02:22 AM