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 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Encode document to Chinese (UTF8)

    Hi. I have a PHP file that is interpreted at run-time bringing together 4 or 5 include files. Most of these files (with extentions "tpl" and "inc") are either ANSI encoded or UTF-8 encoded.

    I have tried in the HEADER include file to change the encoding to UTF-8 by adding:

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

    But this doesn't help... I still have to MANUALLY change Internet Explorer / Firefox settings by clicking on VIEW -> ENCODING -> UNICODE (UTF8) in order to have the correct display, otherwise it comes out a garbled mess.

    Please see this to understand what I am talking about.

    I don't want the user to manually change the encoding... how to make it automatic?

    素不相识

  • #2
    Regular Coder
    Join Date
    Sep 2005
    Location
    Liverpool
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure how to make it automatic, but I would strongly suggest that all files are of the type utf-8 rather than mixing them.

    I believe you may have to send the following header:
    Code:
    Content-Type: text/html; charset utf-8
    http://www.w3.org/International/tuto...rial-char-enc/ has more info on the subject.

    However the pages displayed fine for me, even though the browser picked up the wrong type!
    my mind is on a permanent tangent

  • #3
    New Coder
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have set the header for the entire document by altering the meta tag of the header include file (which should logically be universal for the entire post rendered HTML file).

    Unless you mean altering the actual PHP header file.

    PHP Code:
    <?

    header
    ("Content-Type: charset=utf-8");

    ...
    other php code...

    ?>
    Is this what you mean? I tried that... didnt work either.

  • #4
    Regular Coder
    Join Date
    Sep 2005
    Location
    Liverpool
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it was, but I'll admit that was a pure guess.

    Looks like it is possibly a server issue, have a look at:
    http://www.w3.org/International/ques...nging-encoding
    and
    http://www.i18nguy.com/markup/serving.html
    which may be useful.

    I now recall that a server where I maintain a site recently changed an apache setting to serve all pages as utf-8. made it easier for me, though you still have to ensure that all the files are saved as utf-8 and not ansi or anything else.
    my mind is on a permanent tangent


  •  

    Posting Permissions

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