0

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

Community
  • 1
  • 1
user3871
  • 12,432
  • 33
  • 128
  • 268
  • Are you trying to put Chinese characters to the editor? Do you send a header like this? header('Content-Type: text/html; charset=utf-8'); – zaynetro Feb 03 '14 at 22:00
  • @zaynetro yes I'm trying to put them in the editor. I sent the header but it doesn't work. – user3871 Feb 03 '14 at 23:15
  • I tried in sublime on ubuntu and I didn't have any problems. http://i.imgur.com/86B5TVz.png – zaynetro Feb 04 '14 at 10:57

1 Answers1

0

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

Len_D
  • 1,422
  • 1
  • 12
  • 21