kwstephenchan Posted November 8, 2006 Share Posted November 8, 2006 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 Quote Link to comment Share on other sites More sharing options...
Shad Posted November 8, 2006 Share Posted November 8, 2006 you need to change your charset value in the meta tag! Quote Link to comment Share on other sites More sharing options...
kwstephenchan Posted November 8, 2006 Author Share Posted November 8, 2006 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. Quote Link to comment Share on other sites More sharing options...
php_joe Posted November 8, 2006 Share Posted November 8, 2006 the character is "funny looking"? like alien letters?If you have IE try this:1. Click on "View" in the toolbar at the top of the window.2. Click on "Encoding"3. Select "Big 5", "Chinese Simplified (GB2312)", or some other Chinese encodingJoe Quote Link to comment Share on other sites More sharing options...
kwstephenchan Posted November 8, 2006 Author Share Posted November 8, 2006 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. Quote Link to comment Share on other sites More sharing options...
brainstem Posted November 8, 2006 Share Posted November 8, 2006 you need to check out php_iconv.dll. http://us3.php.net/manual/en/ref.iconv.php Quote Link to comment Share on other sites More sharing options...
php_joe Posted November 8, 2006 Share Posted November 8, 2006 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 Quote Link to comment Share on other sites More sharing options...
kwstephenchan Posted November 9, 2006 Author Share Posted November 9, 2006 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 XP2. Dreamweaver preference char set is big 53. defined in meta content as big 5All 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.