Results 1 to 8 of 8

Thread: php Unicode

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    php Unicode

    Hello, I would like my blog to be a Unicode enabled site. How am I going to do that? My blog is very simple, there are fields of EntryNum, Date, Title and Content in mysql database, but I want write some characters into my entry and save it to mysql, after that retrieve those characters and display on browser. Any thoughts?

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: php Unicode

    Quote Originally Posted by vbbit
    Hello, I would like my blog to be a Unicode enabled site. How am I going to do that? My blog is very simple, there are fields of EntryNum, Date, Title and Content in mysql database, but I want write some characters into my entry and save it to mysql, after that retrieve those characters and display on browser. Any thoughts?
    Just send the encoding format from the PHP header function, the encoding meta tag does not work unless your a bot

    I know MysQL can store UTF-8 so you shoud be fine there also.

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,170

    Re: php Unicode

    What is encoding format from the PHP header function?

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: php Unicode

    Quote Originally Posted by vbbit
    What is encoding format from the PHP header function?
    http://uk.php.net/header

    Should help

    If you site is an XM spec. you can use something like this:

    PHP Code:
    <?php
      header
    ('Content-type: application/text-html');
      echo 
    '<?xml version="1.0" encoding="UTF-8"?>' "\n";
    ?>
    Or the IE blocker

    PHP Code:
    <?php
      header
    ('Content-type: application/xhtml+xml');
      echo 
    '<?xml version="1.0" encoding="UTF-8"?>' "\n";
    ?>
    Cheers,

    Ryan Jones
    Last edited by john tindell; Mar 5th, 2006 at 07:35 AM. Reason: Fixed PHP Tags
    My Blog.

    Ryan Jones.

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: php Unicode

    PHP doesn't support unicode by default. However, you can either compile Multi-Byte String support into PHP or do it your self:

    http://www.randomchaos.com/documents...hp_and_unicode
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: php Unicode

    Quote Originally Posted by visualAd
    PHP doesn't support unicode by default. However, you can either compile Multi-Byte String support into PHP or do it your self:

    http://www.randomchaos.com/documents...hp_and_unicode
    Wasn't the queston about MySQL support too? I know 4.1.1 suports it because our server supports it and thats what I have

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

  7. #7
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: php Unicode

    Yeah, the question was about MySql; but I assumed he might want to use PHP collect and display the information.

    Unicode characters below 255 display fine, however, characters with a higher value will be interpreted by PHP as two separate characters. The resulting output then gets scrambled.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: php Unicode

    header('Content-type: application/text-html');
    Um, it's "text/html" - "application/text-html" doesn't exist.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width