Welcome Back To IDN Forums - International Domain Name Forums - we are an Adsense Revenue Sharing Forum
IDN Forums - IDN Domains
IDN Domains
 

Go Back   IDN Forums - IDN Domains > IDN Discussions > General Discussion
User Name
Password


Reply
 
Thread Tools Display Modes
  #1  
Old 05-06-2007, 09:56 PM
mulligan's Avatar
mulligan mulligan is offline
ドメイン名.ws
 
Join Date: Jan 2006
Posts: 2,282
Rep Power: 0
mulligan is an unknown quantity at this point
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)
__________________
元.net | 米.net | 宮.net | 白.net | 華.net | 八.tv | 蘭.net | 馬.net | 安.net | 牛.net | я.net | ン.net | 灶.com
無料壁紙.jp ~ Free Wallpaper ~ Reasonable offers considered
IDNPool.com ~ Domain Portfolio
Transactions not completed within 7 days from end of sale/auction are void
Reply With Quote
Sponsored Links
  #2  
Old 05-06-2007, 10:43 PM
clipper clipper is offline
fool
 
Join Date: Mar 2007
Location: The Office
Posts: 317
Rep Power: 2
clipper is on a distinguished road
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 : 05-06-2007 at 10:46 PM. Reason: Automerged Doublepost
Reply With Quote
  #3  
Old 05-06-2007, 10:57 PM
xxbossmanxx's Avatar
xxbossmanxx xxbossmanxx is offline
Senior Member
 
Join Date: Dec 2006
Posts: 421
Rep Power: 0
xxbossmanxx is an unknown quantity at this point
Send a message via MSN 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. Will work for food
http://www.im4poker.com/
Reply With Quote
  #4  
Old 05-06-2007, 11:02 PM
jacksonm's Avatar
jacksonm jacksonm is offline
Senior Member
 
Join Date: Feb 2007
Posts: 3,184
Rep Power: 0
jacksonm 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  
Old 05-07-2007, 12:57 AM
mdw mdw is offline
Senior Member
 
Join Date: Jul 2006
Posts: 464
Rep Power: 3
mdw is on a distinguished road
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  
Old 05-07-2007, 10:09 AM
jacksonm's Avatar
jacksonm jacksonm is offline
Senior Member
 
Join Date: Feb 2007
Posts: 3,184
Rep Power: 0
jacksonm 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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.5
Style Design By: Resourcelabz.se
Copyright Urban Japan, Inc. 2005, 2006


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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99