#1
  1. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    691
    Rep Power
    200

    Ob_start and utf character encoding


    Hi everyone. I'm trying to output some asian characters. They output fine, unless I do it from an output buffer.

    The DB is UTF-8 and everyone else is set to UTF-8.

    At the start of the script and right before the buffer I have the following...

    PHP Code:
    mb_internal_encoding('UTF-8');
    mb_http_output('UTF-8');
    mb_http_input('UTF-8');
    mb_language('uni');
    mb_regex_encoding('UTF-8');

    ob_start("mb_output_handler"); 
    Any idea's why my asian characters return fine except in the output buffer?
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,998
    Rep Power
    9397
    Since the mb buffer shouldn't be changing anything, is there a reason why you're using it in the first place? Why not just a normal buffer and simply
    PHP Code:
    ob_start(); 
  4. #3
  5. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    691
    Rep Power
    200
    Thats what I had originally with no luck. I found mb mb_buffer stuff here...
    http://allseeing-i.com/How-to-setup-your-PHP-site-to-use-UTF8
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,998
    Rep Power
    9397
    You don't actually need the output buffer part. Odds are you don't even need output buffering at all.

    With or without ob_start() it should work. If not then there's a problem somewhere else.
  8. #5
  9. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    691
    Rep Power
    200
    I do need and output buffer because of the way our software works, but I figured it out.

    I was doing a manual utf8_encode further down the pipe, and that was breaking the asian characters.

IMN logo majestic logo threadwatch logo seochat tools logo