IDN Forums - Internationalized Domain Names  
Home | Advertise on idnforums | Premium Membership

Go Back   IDN Forums - Internationalized Domain Names > IDN Discussions > General Discussion

General Discussion Feel free to talk about anything and everything in this board.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 6th May 2007, 09:56 PM
mulligan's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 4,253
iTrader: (78)
Rep Power: 2029
mulligan will become famous soon enoughmulligan will become famous soon enoughmulligan will become famous soon enoughmulligan will become famous soon enoughmulligan will become famous soon enoughmulligan will become famous soon enoughmulligan will become famous soon enoughmulligan will become famous soon enough
Unicode/UTF-8 and PHP and a possible solution?

In an ordinary PHP editor if I paste unicode characters into it they show up as ????

So to try and get round this I open whatever PHP file Im working on in notepad, insert whatever unicode I want into the file and then save the file using the unicode or utf-8 encoding.

To force it to save as a PHP file I just enclose the file name in "double quotes" so it would I look type something like "template.php" into the File Name box

This seems to work but do any of you experts know if this is Ok to do or is it likely to cause problems somewhere down the line?

(I haven't had any problems so far)

Or is there a unicode compliant PHP editor available or does PHP and unicode just not mix well?

(I am totally new to PHP so any input is welcome)
Reply With Quote
  #2 (permalink)  
Old 6th May 2007, 10:43 PM
clipper's Avatar
Senior Member
 
Join Date: Mar 2007
Location: The Office
Posts: 1,003
iTrader: (26)
Rep Power: 3112
clipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the roughclipper is a jewel in the rough
Re: Unicode/UTF-8 and PHP and a possible solution?

Any text editor that can save as UTF-8 should work. You shouldn't need to use the quotes, just use .php as the extension in the filename. I use notepad2, which gives you basic html syntax markers and numbers each line.

Quote:
Originally Posted by mulligan
In an ordinary PHP editor if I paste unicode characters into it they show up as ????
Also, I don't know about a php editor, but in Adobe Golive the unicode characters come up as ???? if you paste them into the layout (or preview) mode. When you paste the text into the source code it shows up fine.

Last edited by clipper; 6th May 2007 at 10:46 PM.. Reason: Automerged Doublepost
Reply With Quote
  #3 (permalink)  
Old 6th May 2007, 10:57 PM
xxbossmanxx's Avatar
Member
 
Join Date: Dec 2006
Location: Detroit
Posts: 429
iTrader: (6)
Rep Power: 0
xxbossmanxx is an unknown quantity at this point
Send a message via AIM to xxbossmanxx Send a message via MSN to xxbossmanxx Send a message via Skype™ to xxbossmanxx
Re: Unicode/UTF-8 and PHP and a possible solution?

It's all good if your server is running mbstring
__________________
I Build sites like this for cash and IDN's.
http://www.rarecom.com/
Reply With Quote
  #4 (permalink)  
Old 6th May 2007, 11:02 PM
jacksonm's Avatar
Senior Member
 
Join Date: Feb 2007
Posts: 3,843
iTrader: (26)
Rep Power: 984
jacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished road
Send a message via MSN to jacksonm Send a message via Skype™ to jacksonm
Re: Unicode/UTF-8 and PHP and a possible solution?

PHP has fairly poor multi-byte character support. Getting it working properly involves a bit of black magic.


I got it working by adding these lines in php.ini


[mbstring]

mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.encoding_translation = On
mbstring.http_input = auto
mbstring.http_output = UTF-8
mbstring.detect_order = auto
mbstring.substitute_character = none;
mbstring.func_overload = 0
mbstring.strict_encoding = On



This, of course, assumes that you have the PHP mbstring module installed. On linux, it looks like this:

# rpm -qa | grep -i mbstring
php-mbstring-5.1.6-3.4.fc6


.
__________________
.
Reply With Quote
  #5 (permalink)  
Old 7th May 2007, 12:57 AM
mdw's Avatar
mdw mdw is offline
Member
 
Join Date: Jul 2006
Location: upstairs
Posts: 838
iTrader: (24)
Rep Power: 573
mdw is an unknown quantity at this point
Re: Unicode/UTF-8 and PHP and a possible solution?

Never had any trouble - and I use standard builds starting at PHP 4.3x and higher.
MySQL, well that's another story. But really no matter where you host these days you should have no problems; if you do then move.
Reply With Quote
  #6 (permalink)  
Old 7th May 2007, 10:09 AM
jacksonm's Avatar
Senior Member
 
Join Date: Feb 2007
Posts: 3,843
iTrader: (26)
Rep Power: 984
jacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished roadjacksonm is on a distinguished road
Send a message via MSN to jacksonm Send a message via Skype™ to jacksonm
Re: Unicode/UTF-8 and PHP and a possible solution?

Quote:
Originally Posted by mdw
Never had any trouble - and I use standard builds starting at PHP 4.3x and higher.
MySQL, well that's another story. But really no matter where you host these days you should have no problems; if you do then move.

The php-mysql driver doesn't handle multi-byte well at all; it was completely unsupported even 6 months ago, and the support was added very recently - still buggy as all hell. I tried for a day to get it working, no cigar. I tried it with postgres, which I should have done to begin with, and it worked fine after I added the above configuration to the php.ini.

.
__________________
.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:23 PM.

Site Sponsors
Your ad here
buy t-shirt
מחיר הזהב

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright idnforums.com 2005

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54