Hi,

I made uploaded 1 set of website sites to different domains (and server) using filezilla. The code is all manually typed using Notepad++.

Now, one site jttech.com.hk show the chinese text, but the other sandbox.desk.vuox.com shows ????????

see http://sandbox.desk.vuox.com/index.php and http://jttech.com.hk/ top right corner, the language selector.

Anyone knows why? This is freaking frustrating!

Thanks for your help.

Dani AI

Generated

Quick summary: ’s final post nailed the root cause (a UTF‑8 BOM), and @ardav was right to push for checking encodings and meta headers. For readers who hit the same symptom (Chinese showing as "?????" or other garbled output), the checklist below explains what the BOM does, how to spot it, and practical fixes that work across editors, FTP uploads and PHP/HTML output.

The BOM is a three‑byte marker at the start of some UTF‑8 files (0xEF 0xBB 0xBF). Some editors or Windows tools add it automatically. On the web it can introduce invisible bytes before the HTML or before PHP’s opening tag, which either breaks headers or makes the byte stream be misinterpreted — the result is question marks or mangled characters. Best practice for pages and templates is UTF‑8 without BOM.

Practical checks and fixes to apply now:

  • Confirm the server sends UTF‑8: run a header check (or use devtools).
curl -I http://yourserver/test.php | grep -i Content-Type
  • Detect a BOM with a hex dump:
xxd -g 1 filename | head
# or
hexdump -C filename | head

If the first three bytes are EF BB BF, there's a BOM.

  • Remove/resave without BOM: in Notepad++ choose an option to save as UTF‑8 without BOM (menu text varies by version), then save and re‑upload. Use binary mode in FileZilla so bytes are preserved.
  • Quick programmatic strip (PHP):
if (substr($s,0,3) === "\xEF\xBB\xBF") $s = substr($s,3);
  • Make sure pages declare and send UTF‑8:
<meta charset="utf-8">
<?php header('Content-Type: text/html; charset=utf-8'); ?>

Also verify any database connections use UTF‑8 (SET NAMES / mysqli_set_charset). Keep every template, include and DB connection consistently UTF‑8 (without BOM) and avoid stray whitespace before <?php. If one server shows the problem and another doesn’t, compare the raw bytes with a hex diff to spot hidden BOMs or extra characters. This set of steps should prevent the same issue from recurring.

Recommended Answers

All 4 Replies

Member Avatar for Member #120589

Can't see any chinese on jttech.com.hk.

Have you used the correct language metas?

Even when you choose ?? (lang option) on the sandbox, the pages are still in English. I switched encoding on my browser to Chinese, but no change.

Ensure that you have saved as UTF-8 format in Notepad++. I think the default is ANSI. This is *probably* your problem.

Thanks ardav,

I just removed the language selector from jttech.com.hk that's why you did not see it. Because it was a live website, I later thought could not just leave it half done and so I removed it.

The problem remains -- I set UTF-8 encondiing on Notepad++ already...

On sandbox.desk.vuox.com if you click ?? on the language, it will show the chinese version. The chinese text is in ??????????????????.
The rest are still in english.

I also notice that if I start with an ANSI file > convert it to UTF-8 > append the same chunk of existing html to the same file by manual typing in (not copy + paste), the two chunk of idenitcal code will appear different in the brower. I will investigate this further...

In the meantime, other the UTF-8 encoding, is there any other possibility?

I have solved the problem myself.

The reason is because there is another flavour of UTF-8 encoding which includes BOM (whatever that is) which adds extra byte information which will confuse the web browser and cause layout/display/text problems.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.