user3871
user3871

Reputation: 12664

Using UTF-8 for Chinese characters and pinyin not working

I'm trying to output Chinese characters and Pinyin from my Game.php file.

In my Game.HTML file, just using <meta http-equiv="content-type" content="text/html; charset=utf-8" /> works fine.

But in my Game.PHP file, it does not. So I tried following these to get it to work:

1) How to best configure PHP to handle a UTF-8 website

2) UTF-8 all the way through

At the top of my Game.PHP file, I've included this in the <head> portion of the HTML... and I've added the specified default_charset to my php.ini file, and the AddDefaultCharset to my Apache file. What am I doing wrong?

enter image description here

Upvotes: 0

Views: 1521

Answers (1)

Len_D
Len_D

Reputation: 1430

You should be able to use the PHP utf8_encode() function. Try $character = utf8_encode(put your character here) and be sure to use single or double quotes around the character.

In NotePAD++

Settings -> Preferences -> New Document/ Open Save Directory

Under New Document Encoding -> check UTF8 without BOM

Upvotes: 0

Related Questions