Jump to content

echo chinese character


kwstephenchan

Recommended Posts

Hi everyone,
I have this problem of displaying chinese characters: I can display chinese character in my php page if I echo them directly. But if I have these echo statement outside of this page (through include or require statement), I get all the funny characters.
Does someone know what did I miss? (I also tried to include the charset command in the external file, but did not work)
Thanks,
Stephen
Link to comment
Share on other sites

I have checked this already, it is big5 (one of the Chinese format).  In addition, I have tried putting this in the external program and it still didn't work.  Any idea what else could cause it??  The funny thing is that I can echo Chinese character in the program but when I put these character into an external program, include or require it in the program and call it to execute, it gives me all these funny character.
Link to comment
Share on other sites

Joe,

Thanks but didn't work. If I change the encoding, it just gives me some other funny characters.  What I am confused is that the funny characters occurred only when I put them in the external program and call this external program from the main program.  If I put them in the main program directly, it displays correctly.  In addition, if I pull these characters from the database, it also displayed correctly.  Is it possible that I cannot call this kind of display from an external program which means that I have to write this piece of codes in every page.
Link to comment
Share on other sites

I was having a simular problem with one of my codes. It would dislpay fine when the chinese word was called in the script, but if it was passed to the script inside of a url then it just showed up as ???.

It was suggested on this forum that I put the php script into a text file, save it under a Chinese encoding, and then try it. I have not had time to try yet so I can't endorse or refute this advise.

Joe
Link to comment
Share on other sites

Hi Joe, I don't know why but it works now.
This is the scenario, in caze, it may be useful to you.
1. server is installed with big5 XP
2. Dreamweaver preference char set is big 5
3. defined in meta content as big 5
All the Chinese character displayed ok but when I put these Chinese characters (cut and paste) into an external file, and then call this external file from the main script, they all turned out to be funny characters.
I tested the program by inserting new Chinese characters into the script AND the external program, the Chinese character from the main script was displayed ok but not those from the external program.
I later checked the external program and found that those Chinese characters in the external program were all funny characters (it was not originally and it was not when I inserted new Chinese characters in it for testing). So I re-type those Chinese characters in the external program, and tested it again, this time, it works fine (really don't know why)
Hope this may be useful to you.  In case you are using UTF-8, try big 5 or GB instead.
Stephen
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.