Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ?? Unicode with PHP

    I'm working on multi language based on PHP, But now my big problem is to convert an UTF-8 char to Unicode char. I'm try use mb_string but my server doesnt allow to use. What I have to do ?
    Thanks for reading

  • #2
    Regular Coder ralph l mayo's Avatar
    Join Date
    Nov 2005
    Posts
    951
    Thanks
    1
    Thanked 31 Times in 29 Posts
    UTF-8 is Unicode.

  • #3
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    UTF-8 supports most international characters.

    Internally and by default, PHP uses iso-8859-1, which may not support the character sets that you wish to support. If your server supports mbstring, then you can change the default charset in php to utf-8 by executing the following command before any processing is performed

    <?php mb_internal_encoding( 'UTF-8' ); ?>

    Perhaps, it has something to do with the default headers set by your server.

    To enforce utf-8, add this at the top of all of php documents, before any echo, or html tags.

    <?php header('Content-Type: text/html; charset=utf-8'); ?>

    To ensure that the correct charset has been selected, on firefox, click Tools -> Page Info...and make sure that it says utf-8 for encoding etc..

    Cheers
    ~E
    Last edited by ess; 01-12-2008 at 04:31 PM.

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by ess View Post
    If your server supports mbstring, then you can change the default charset in php to utf-8 by executing the following command before any processing is performed

    <?php mb_internal_encoding( 'UTF-8' ); ?>
    Quote Originally Posted by ~Fyodor View Post
    I'm try use mb_string but my server doesnt allow to use.

  • #5
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    Quote Originally Posted by Inigoesdr View Post
    and your point is

    I know that he/she said that his/her server does not support that functionality...and that is why I stated "If your server....etc."...so others, including himself/herself, with a similar requirements may find it useful...or perhaps he/she may reconsider their hosting provider so that they can switch to a host who provides such functionalities...etc.

    I am not here to take the piss out of people, which you seem to be happy doing, nor expect people to take the piss out of me. I am simply here to learn, and help others where I can.

    So please, keep your jokes, stupidity, mischief, etc. to yourself...as I don't think anyone here has come for your charm.
    Last edited by ess; 01-13-2008 at 02:50 PM.

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by ess View Post
    I am not here to take the piss out of people, which you seem to be happy doing, nor expect people to take the piss out of me. I am simply here to learn, and help others where I can.

    So please, keep your jokes, stupidity, mischief, etc. to yourself...as I don't think anyone here has come for your charm.
    Did you have a bad day? That post is a bit strongly worded considering the circumstances. I didn't launch any personal attack on you. I pointed out that your post wasn't very useful, as this user obviously already knew about mb_string, and specifically stated that they couldn't use it. Even if you were posting the information for others mb_string had already been mentioned so at best you were rehashing information. I apologize if you took it personally, and I hope no one is here for my charm as they will be sorely disappointed.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •