damilola Posted April 16, 2013 Share Posted April 16, 2013 Hello people, pls I need help on dis one. Does Php version 5.4.3 support unicode. Cause after lauching d phpinfo page I can't see the uincode section, like larry screenshot it in the 'Making a Universal site' chapter. Pls help out. Thank u §☺ much, really appreciate Link to comment Share on other sites More sharing options...
HartleySan Posted April 16, 2013 Share Posted April 16, 2013 Yes, it definitely does. Don't worry about that. Link to comment Share on other sites More sharing options...
damilola Posted April 16, 2013 Author Share Posted April 16, 2013 Thank u §☺ much fø̲̣̣я̅ d fast reply sir. Link to comment Share on other sites More sharing options...
Antonio Conte Posted April 16, 2013 Share Posted April 16, 2013 I think your keyboard is drunk, damilola. It replaces characters with silly replacement symbols. Tell it to sober up! Link to comment Share on other sites More sharing options...
damilola Posted April 19, 2013 Author Share Posted April 19, 2013 Ahahahahah, Antonio, it aint drunk am typing from my blackberry. Will turn the symbol thing off now. Pls I jst installed Wamp 2.2, and it came with php 5.4.3. But I still can run the unicode.php example, am getting the fig 14.9 answer. Doesn't php 5.4.3 support unicode. Pls help. Link to comment Share on other sites More sharing options...
HartleySan Posted April 19, 2013 Share Posted April 19, 2013 Please post the exact code you're using. Link to comment Share on other sites More sharing options...
damilola Posted April 24, 2013 Author Share Posted April 24, 2013 This is d code : <?php header ('Content-Type: text/html; charset=UTF-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $names = array('joάo','ҐѾργζ', 'Anton', 'KamilÐ', 'FranĞiška','愛子', '杰西卡'); foreach ($names as $name) { echo "<p>$name has ".strlen($name)." characters <br />\n".strtoupper($name)." in capital letters</p>\n"; } ?> </body> </html> The result when i run the code: joάo has 5 characters JOάO in capital letters ҐѾργζ has 10 characters ҐѾργζ in capital letters Anton has 5 characters ANTON in capital letters KamilÐ has 7 characters KAMILÐ in capital letters FranĞiška has 11 characters FRANĞIšKA in capital letters 愛子 has 6 characters 愛子 in capital letters 杰西卡 has 9 characters 杰西卡 in capital letters My phone browser cannot display the chinesse words. Thank u §☺ much. Link to comment Share on other sites More sharing options...
Larry Posted April 25, 2013 Share Posted April 25, 2013 Could you clarify what your question is? Link to comment Share on other sites More sharing options...
HartleySan Posted April 25, 2013 Share Posted April 25, 2013 damilola, I ran your exact script through my web server and loaded it on my iPhone, and everything displayed as it should. I don't see the problem. Link to comment Share on other sites More sharing options...
damilola Posted April 25, 2013 Author Share Posted April 25, 2013 †ђξ problem here is that, I think there are some setting I need get done that am not getting, I just installed WAMP 2.2 which has PHP 5.4.14, which I belive has unicode support. If †ђξ unicode support where enabled, I will not be getting †ђξ result I posted. Pls help. Link to comment Share on other sites More sharing options...
HartleySan Posted April 25, 2013 Share Posted April 25, 2013 There is no setting for Unicode in PHP, per se, in that it's always available. All you need to do is set the content type to UTF-8 either using the PHP header function or with an HTML meta tag. Beyond that, there's nothing you need to do. All browsers should know how to interpret either to properly display Unicode characters. And like I said, your script above works fine. What I can't understand though is why all your posts contain all sorts of weird characters. Link to comment Share on other sites More sharing options...
damilola Posted April 26, 2013 Author Share Posted April 26, 2013 Fenks, will try other browsers on my system. Am typing from my Blackberry, the reason for the wierd character. Link to comment Share on other sites More sharing options...
HartleySan Posted April 26, 2013 Share Posted April 26, 2013 As far as I know, typing from a Blackberry should not cause the weird characters, but anyway... Link to comment Share on other sites More sharing options...
damilola Posted May 12, 2013 Author Share Posted May 12, 2013 People pls help me, am nt still geting this thing. Do I have to make any change in my php.ini file fø̲̣̣я̅ my wamp to surport UNICODE. Am using php 5.4.3., wamp 2.2 to be precise. Pls I need full understanding of this thing, mayb I am missing something in the book. Cos according to the book only php 6(php 5.4) has UNICODE support. §☺ pls what am I missing. Thak you. Link to comment Share on other sites More sharing options...
HartleySan Posted May 12, 2013 Share Posted May 12, 2013 Please show us the exact code you are using and a detailed description or screenshot of the problem. Thank you. Link to comment Share on other sites More sharing options...
damilola Posted May 21, 2013 Author Share Posted May 21, 2013 This is the code, and someone said it runs fine. <?php header ('Content-Type: text/html; charset=UTF-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/ TR...ransitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/ html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $names = array('joάo','ҐѾργζ', 'Anton', 'KamilÐ', 'FranĞiška','愛子', '杰西卡'); foreach ($names as $name) { echo "<p>$name has ".strlen($name)." characters <br />\n".strtoupper($name)." in capital letters</p> \n"; } ?> </body> </html> This is the result: joάo has 5 characters JOάO in capital letters ҐѾργζ has 10 characters ҐѾργζ in capital letters Anton has 5 characters ANTON in capital letters KamilÐ has 7 characters KAMILÐ in capital letters FranĞiška has 11 characters FRANĞIšKA in capital letters 愛子 has 6 characters 愛子 in capital letters 杰西卡 has 9 characters 杰西卡 in capital letters. (This can be crosschecked on page 444 of the book). According to the book, the result above will be gotten if am using php 5.2 or less. But am using php5.4.3, which I belive is php6, which according to the book has unicode support. Have already defaulted my dreamweaver to utf-8 encoding. So pls what could be worng. And one more thing when I call the phpinfo() I can't see section for unicode settings.Pls help out. Link to comment Share on other sites More sharing options...
HartleySan Posted May 21, 2013 Share Posted May 21, 2013 PHP 5.4.3 is not PHP 6, it's PHP 5.4.3. Also, I would expect the result in PHP versions earlier than 5.2 to be exactly the same as PHP 5.4.3. Furthermore, your resulting code seems fine. In other words, what is the problem? Link to comment Share on other sites More sharing options...
damilola Posted May 21, 2013 Author Share Posted May 21, 2013 According to the book, larry said php 5.2 will give the result I just posted. Am thinking maybe I have to do somethings in my php.ini file. Or shld I jst reinstall the wamp 2.2. Am very sorry if am disturbing HartleySan, just don't like not geting a part of a book am reading, I find it hard to move on to other chapters. Link to comment Share on other sites More sharing options...
HartleySan Posted May 21, 2013 Share Posted May 21, 2013 Like I have already said multiple times, I tested your script, and it worked fine in my environment and the results you have posted here (several times) seems fine as well. Please tell me what you think the problem is, or I can no longer help. Thank you. Link to comment Share on other sites More sharing options...
StephenM Posted May 25, 2013 Share Posted May 25, 2013 @damilola Perhaps your phone doesn't support utf-8? And that is the problem? @anyone I just changed the code a little to add detect encoding. I was surprised to see that 'Anton' has come out as ASCI Why not UTF-8? <?php header ('Content-Type: text/html; charset=UTF-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/ TR...ransitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/ html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php $names = array('joάo','ҐѾργζ', 'Anton', 'KamilÐ', 'FranĞiška','愛子', '杰西卡'); foreach ($names as $name) { echo "<p>$name has ".strlen($name)." characters <br />\n".strtoupper($name)." in capital letters <br />\n".mb_detect_encoding($name)." </p> \n"; } ?> </body> </html> Link to comment Share on other sites More sharing options...
HartleySan Posted May 25, 2013 Share Posted May 25, 2013 UTF-8 is backwards compatible with ASCII. This allows for easy conversion to UTF-8 from legacy systems using ASCII, and it makes UTF-8 more compact when possible. Link to comment Share on other sites More sharing options...
damilola Posted May 31, 2013 Author Share Posted May 31, 2013 Thank u §☺ much @hartlySan and StephenM, I really appreciate u all. Now going by the book and the authour, on page 423 we can have 2 result of d Script 14.2 based on the version of php u are running(which has been displayed above), which are the following: U get this when running php6: joάo has 4 characters JOάO in capital letters ҐѾργζ has 7 characters ҐѾργζ in capital letters Anton has 5 characters ANTON in capital letter s KamilÐ has 5 characters KAMILÐ in capital letters FranĞiška has 6 characters FRANĞIšKA in capital letters 愛子 has 2 characters 愛子 in capital letters 杰西卡 has 3 characters 杰西卡 in capital letters U get this when running under Php5.2: joάo has 5 characters JOάO in capital letters ҐѾργζ has 10 characters ҐѾργζ in capital letters Anton has 5 characters ANTON in capital letters KamilÐ has 7 characters KAMILÐ in capital letters FranĞiška has 11 characters FRANĞIšKA in capital letters 愛子 has 6 characters 愛子 in capital letters 杰西卡 has 9 characters 杰西卡 in capital letters Now d issue is that am using php 5.4.3, which according to what have seen and read from the net is that php 5.4 is the latest version of php, php 6 is not yet out there. §☺ since am using Php 5.4.3, y am I get a result for php 5.2 or below ?. Pls this is my main problem, am a beignner with php and I have found it hard to move forward, cos ave been stuck witb dis issue for alomst a month now. Don't mean to take up ur time, jst need help. Thank you so much people. Link to comment Share on other sites More sharing options...
HartleySan Posted May 31, 2013 Share Posted May 31, 2013 The results of this script will be the same in PHP 5.4.3, 5.4 or 5.2. It doesn't matter. This is a very basic script, and Unicode support has been around forever. I still don't see the problem, and at this point, I'm wondering if you're trying to troll us. Link to comment Share on other sites More sharing options...
Antonio Conte Posted May 31, 2013 Share Posted May 31, 2013 Dude. PHP 6 has been revised. A lot of the plans of PHP 6 was added to PHP 5.3 instead. The book is outdated in some regards. Listen to Jon. Link to comment Share on other sites More sharing options...
damilola Posted June 1, 2013 Author Share Posted June 1, 2013 Am not trying to troll u people, but thanks for all the help I really appreciate. Link to comment Share on other sites More sharing options...
Recommended Posts