Japanese Characters in php document

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

[quote="onejoy1"]I got:

Warning: Cannot modify header information - headers already sent by (output started at /home/users/sjg5005/http/nihongo/directory2.php:1) in /home/users/sjg5005/http/nihongo/directory2.php on line 1
ã
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

Code: Select all

<?php header("Content-type: text/css; charset: UTF-8"); ?>
<html>
<body>
<? echo "&#12399;&#12376;&#12417;&#65281;"; ?>
</body>
</html>
is what I put in the wordpad file.

ÿþ<?php header("Content-type: text/css; charset: UTF-8"); ?> <html> <body> <? echo "o0X0
Gambler
Forum Contributor
Posts: 246
Joined: Thu Dec 08, 2005 7:10 pm

Post by Gambler »

I don't understand what Gambler means by save files as utf-8, unless you mean to make sure that when I save them, the encoding is set to utf-8?
Files may have different encodings. It can be, for example, ISO-8858-1, or UTF-8. If you save file in one encoding, but identify it as another, it will probably be displayed as junk. Good editors allow you to see what encoding you are using.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Notice that you have a space before <?php ... And there should be absolutely *no* output if you use the http://www.php.net/header function...
eyespark
Forum Commoner
Posts: 50
Joined: Tue Jan 24, 2006 7:36 am

Post by eyespark »

Output causing error might also be BOM (byte order mark for utf-8 ). You should save your file without BOM.
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

Code: Select all

<?php header("Content-type: text/css; charset: UTF-8"); ?>
<html>
<body>
<? echo "&#12399;&#12376;&#12417;&#65281;"; ?>
</body>
</html>
There is no space there, that's just how it copied.

How do I save the file without BOM?
eyespark
Forum Commoner
Posts: 50
Joined: Tue Jan 24, 2006 7:36 am

Post by eyespark »

If you are using DW8 there is an option when you are saving your file.

Or...

http://www.w3.org/International/questions/qa-utf8-bom
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

I'm using DW6. I can't find a way to remove the BOM. I also tried writing it in notepad and wordpad and still the characters remained.

I read somewhere that there is a script to remove the BOM if it cannot be removed manually, but I can't find a script anywhere that would do that.
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

I'm still trying to figure out a way to save a file w/o the BOM. Can anyone help me?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

stop using Dreamweaver? You can search through the Editors thread (link can be found in the Forum Tour) for other more useful Unicode compliant editors
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

lol, I'm using dreamweaver because the other person I'm doing this project on hasn't used anything but dreamweaver before. So I have no choice..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yeah you do. What editor you use shouldn't have baring on what editor that person uses. :?
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

Regardless, do you know an editor that I can save without the BOM with? I looked for the editor's section but I couldn't find it.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Forum Tour wrote:The Favorite Editor thread
viewtopic.php?t=43206
A thread & poll that brings up the question: What is your favorite editor?
onejoy1
Forum Newbie
Posts: 14
Joined: Sun Feb 05, 2006 4:50 am

Post by onejoy1 »

Thanks!
Post Reply