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

Thread: inline encoding

  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    inline encoding

    Hi,

    Most of my document's data is iso-8859-1 character encoding however some data that comes from an rss feed is UTF-8. Is there a way to change the encoding of an html document half way through so that most the data is iso-8859-1 but the news is UTF-8? Any ideas?
    You can not say you know how to do something, until you can teach it to someone else.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Do you have any issue if you use UTF-8 at the top instead of your current one?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    Yes the other data displays properly only if ISO-8859-1 is set at top. However the news feed data only displays properly if UTF-8 is set at top
    You can not say you know how to do something, until you can teach it to someone else.

  • #4
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by timgolding View Post
    Yes the other data displays properly only if ISO-8859-1 is set at top. However the news feed data only displays properly if UTF-8 is set at top
    Then you want your all data (UTF-8 and ISO-8859-1) work properly in the same page?

    as far as i now work with 2 different encoding charset in 1 page still not accepted by existing browser, but i hope browser development pierce it.

    but if you can handle with auto switch encoding charset, i was post it at http://www.codingforums.com/showthread.php?t=186062

    & maybe you can fix it using file_get_contents /php get file (or get url) then input to one page. e.g.

    Code:
    <textarea rows="20" cols="50"> 
    <?php
    $charset='UTF-8';
    $str=file_get_contents('content.html');
    echo htmlspecialchars($str, ENT_COMPAT, $charset); ?>
    </textarea>
    or similar to it. note: i not tested it yet

    Regards,
    Last edited by sir.jones; 01-09-2010 at 07:09 AM.

  • Users who have thanked sir.jones for this post:

    timgolding (01-11-2010)


  •  

    Tags for this Thread

    Posting Permissions

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