SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: UTF8 problem with PHP

  1. #1
    SitePoint Zealot phpguru's Avatar
    Join Date
    Sep 2005
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    UTF8 problem with PHP

    here's my file

    Code:
    <?
    $LANG["default_value"] = "Giá trị mặc định";
    $LANG["update"] = "Cập nhật";
    
    
    print_r($LANG);
    ?>
    And here's my output

    Cn_US.UTF-8
    So, what's goin on :| , how to fix it?

  2. #2
    SitePoint Addict
    Join Date
    May 2006
    Location
    Austin
    Posts
    398
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You might try using this at the top of the page:

    header('Content-type: text/html; charset=UTF-8') ;

    Not sure if it will do anything though.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well for one thing php doesnt support unicode too well

    then send a header as mention above

    also set the meta html tag with utf8

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

    also use mbstring php extension for unicode string manioulation

    and make sure your file is saved in unicode encoding

  4. #4
    SitePoint Zealot phpguru's Avatar
    Join Date
    Sep 2005
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't think problem with encoding.
    i think it's occurred from web server :-?

    because with same this file, it running okey on other server
    i encoded this file with many character encoding: utf-8 , iso 8859-1

    but still this error :|

Bookmarks

Posting Permissions

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