TanakaSakana
TanakaSakana

Reputation: 71

How to display text of both Chinese and Japanese?

I am using the php plugin "h5ai" to share all file in the directory. Meanwhile, my files include Chinese and Japanese titles. I have used the method from: 1 to resolve the encoding problem.

 public function to_href($path, $trailing_slash = true) {
    $path = mb_convert_encoding( $path, "UTF-8" , "SJIS" );

Encoding for Chinese: Big5;and Japanese: SJIS

The major problem is that, this way only resolve the encoding problem of either one language, for instance, if I change encoding for Chinese, Japanese file won't be able to display.

Is it a possible way to display both files of Chinese and Japanese title?

Upvotes: 0

Views: 381

Answers (1)

Muhammed Imran Hussain
Muhammed Imran Hussain

Reputation: 2125

You can define multiple from_encoding type separated by comma or an array of from_encoding. For example:

public function to_href($path, $trailing_slash = true) {
    $path = mb_convert_encoding( $path, "UTF-8" , "Big5, SJIS" );
}

Please find mb_convert_encoding function details here http://php.net/manual/en/function.mb-convert-encoding.php

Upvotes: 1

Related Questions