Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chinese unicode cant use includes?

Status
Not open for further replies.

dl01

Technical User
Jun 25, 2001
15
NL
Ive been putting a website together for a while that got bigger as time went on so I started using includes for the menus etc which helped when I ever needed to change anything (Im very new to web building btw).

I changed all my pages to shtml to be able to do this and it works for all the ANSI pages but not for the unicode pages with Chinese text, it just displays the actual content of the unicode file but without the include file content. This is a problem as most of the text will need translating soon on the other pages as it is a bilingual site and I dont want to have to work without includes as it will be difficult to manage. Im guessing there is a way around this has anyone seen this scenario before?

So how can I either get an ANSI file to take unicode Chinese characters or, get a unicode file to work with includes? So far I've tried shmtl like this;

<!--#include virtual=&quot;header.txt&quot;-->

and php like this;

<?php include("header.txt"); ?>

but no joy.

Thanks for any help


 
I don't see any reason why the choice of character set should influence whether includes work. A few things to check/try:

Do a "view source" on the chinese pages when you view them through a browser. Do you see the include statements in the source?

Have you got the right path to the included file? If the Chinese pages are in a different directory to the English, that would explain why they're not working.

On the php page, try putting in some simple php commands like
Code:
<?php print "Hello World"; ?>
That'll tell you whether php is being executed at all on that page.

If all else fails, start with a working English page and add attributes of the Chinese pages one-by-one till you find the one that causes it to fail.

My guess is that it's file paths though.

If you're starting off with includes, you may also find this FAQ useful: faq253-6554

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks Chris

I tried it but still no luck. Heres what I did.

I created a test ANSI php text doc and put this text into it;

<html>
<body>
<?php print "Hello World"; ?>
<h1>Welcome to my home page!</h1>
</body>
</html>

uploaded it to my site and it outputs the php line and the <h1> line;

Hello World
Welcome to my home page!


I then saved the file as unicode so I could put in some Chinese characters;

<html>
<body>
<?php print "Hello World"; ?>
<h1>????</h1>
</body>
</html>

uploaded it to my site but this time it only outputs the <h1> line and not the php line;

????


It seems like there is something different in the way unicode handles includes?

Thanks

Dan



 
Hmmm....

Looking at the View Source, it's clear that the php command is not being picked up and executed in the unicode version.

You could try posting in forum434 to see if anybody else has met the same problem. I think it's likely to be a server configuration issue, so maybe the forum dedicated to your webserver software (e.g. forum65 ) might be a good place too.

What flavour of unicode are you using to encode your text? Is it possible for you to use utf-8? I suspect your page is currently using utf-16 or some other unicode format that uses multiple bytes for each character. The web server is expecting standard ASCII text with one byte per character, and is thus failing to interpret the <?php bits properly.

If you can use utf-8, it uses one byte per character for normal ASCII characters and muliple bytes for the more exotic characters that need them.

I'm a good way out of my comfort zone when dealing with character sets, most of hat I do know comes from this article:
-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top