Special characters problem (flat file cms)

I’ve written a very small flat file CMS which has problems with special characters. (like Chinese, German, Japanase). (The content is saved to .txt files).

I found something that only fixes German letters (ü, ö) and a few other special characters with:

$content = mb_convert_encoding($content, 'UTF-8');

What I’ve tried so far to fix the problem is - putting all the files into coding type UTF-8 and 5 other solutions that didn’t work so far:

htmlentities($content, ENT_QUOTES, 'UTF-8') ; html_entity_decode($content, ENT_QUOTES, 'UTF-8') ; htmlspecialchars($content, ENT_QUOTES, 'UTF-8') ; fwrite($file, utf8_encode($content)); $content = htmlspecialchars($content, ENT_COMPAT, 'UTF-8');

It’s weird that on some servers, this CMS works perfectly without any extra code and accepts Chinese, Japanase, Hebrew, Arabic and any kind of foreign language with special characters.

Information that could help:
The error when trying to enter a special character: false.

If I manually write a special character into the text file, it displays it properly, but when trying to edit it, it just displays false again.

I can’t make an attachment to this post but if you want to test it online just go to the http://krneky.com/wondercms (password is admin).

(If wanted, I can also provide a download link for these willing to help out).

Sponsor our Newsletter | Privacy Policy | Terms of Service