As the name says. I can't seem to find an answer with any of the following questions: php headers, css headers, html headers, mysql encodings (to utf8_general_ci) or
<form acceptcharset="utf-8"... >
In fact, it really is.
I mainly live through this process:
- Enter Japanese characters, follow through the form
- Saving a form in MySQL DB
- PHP retrieves data from a MySQL database and formats it for a web page.
In step 3, I check the code and see that it literally displays Japanese characters. Since this does this, I assume that it causes the PHP errors that I get (functions that work fine for English characters don't work that good for Japanese text).
So, I want to encode in UTF-8 format, but I'm not sure how to do this?
Edit: here is the PHP function that I use in Japanese text
function short_text_jap($text, $length=300) {
if (strlen($text) > $length) {
$pattern = '/^(.{0,'.$length.'}\\b).*$/s';
$text = preg_replace($pattern, "$1...", $text);
}
return $text;
But instead of a reduced amount of text, it returns all this.
source
share